.class文件从jython与pydev [英] .class file from jython with pydev

查看:150
本文介绍了.class文件从jython与pydev的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试jython是一个java / jython项目,我在eclipse中用pydev编写。

My first attempt at jython is a java/jython project I'm writing in eclipse with pydev.

我创建了一个java项目,然后将其作为一个pydev项目通过RightClick项目>> pydev >>设置为...你得到的想法。然后我添加了两个源文件夹,一个用于java,一个用于jython,每个源文件夹都有一个包。我将每个文件夹设置为项目的构建路径。我想我正在让你知道所有这一切,希望你能告诉我,或者我不是正确设置项目。

I created a java project and then made it a pydev project by the RightClick project >> pydev >> set as... you get the idea. I then added two source folders, one for java and one for jython, and each source folder has a package. And I set each folder as a buildpath for the project. I guess I'm letting you know all this so hopefully you can tell me wether or not I set the project up correctly.

但真正的问题是:如何让我的jython代码变成一个类文件,以便java代码可以使用它?首选方法是eclipse / pydev会自动为我做这个,但是我无法理解。 jython用户指南中提到的内容意味着这是可能的,但我无法在任何地方找到信息。

But the real question is: how do I get my jython code made into a class file so the java code can use it? The preferred method would be that eclipse/pydev would do this for me automatically, but I can't figure it out. Something mentioned in the jython users guide implies that it's possible but I can't find info on it anywhere.

编辑:我找到一些信息 here 这里,但事情并不顺利。

I did find some information here and here, but things are not going too smooth.

我有在第二个链接中遵循指南,但我无法弄清楚如何让jythonc为我的python类创建一个构造函数。

I've been following the guide in the second link pretty closely but I can't figure out how to get jythonc to make a constructor for my python class.

推荐答案

Jythonc不再存在,已经被分配到另一个名为 Clamp 的项目,但是说...

Jythonc doesn't exist anymore, it has been forked off to another project called Clamp, but with that said...


...你可以预编译
你的python脚本到.class文件
使用:

...you can pre-compile your python scripts to .class files using:

jython [jython home] / Lib / compilea ll.py
[保存
python代码的目录]

jython [jython home]/Lib/compileall.py [the directory where you keep your python code]

源 - Jython Newsletter 2009年3月

Source - Jython Newsletter, March 2009

当我使用Python 2.7 代码(知道它将在Jython 2.5 中失败)的文件夹时,它确实输出了.class文件,即使它不起作用尝试使用您的Jython脚本。如果它有效,请让我们知道,因为我会在那里你很快。

When I fed it a folder with Python 2.7 code (knowing it would fail in Jython 2.5) it did output a .class file, even though it doesn't function. Try that with your Jython scripts. If it works, please let us know, because I'll be where you are soon enough.

一旦你远,转换你的命令行语句到PyDev中的外部工具,可以根据需要调用。

Once you're that far, it isn't hard to convert your command line statement to an External Tool in PyDev that can be called as needed.

这篇关于.class文件从jython与pydev的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆