jython setup in Eclipse/PyCharm

2019-04-13 01:10发布

Using Python 2.7 on Mac, and IDE is PyCharm. Need to use some Java functions inside Python script, and prefer to use import of Python, for example from com.a.b.c import fooFunc, so that I can use fooFunc in Python script as a Python function. The Java functions are defined in goo.jar.

My question is, where should I place the goo.jar file, so that Python/PyCharm could find the jar file?

Edit 1, add screen snapshot for PyDev for Jython project,

enter image description here enter image description here

Edit 2, add screen snapshot for auto-config error message,

enter image description here

Edit 3, cannot select installed jython interpreter from Eclipse, enter image description here enter image description here

Edit 4, can only select .jar file when configuring jython interpreter,

enter image description here

Edit 5, program runs ok but with red alert error messages from console,

enter image description here

enter image description here

1条回答
smile是对你的礼貌
2楼-- · 2019-04-13 01:46

Follow up on the comments above, yes if you are using pydev for eclipse, then that's just the plugin that allows for writing python code with eclipse. To install jython, there are a number of guides out there, but it boils down to a two step process:

  1. Download and install jython. The installation process will usually tell you where jython is installed
  2. Next Configure pycharm to include the location of jython. As the jetbrains family of IDE's are very much the same, the way I added jython to intelliJ is to do File > Project Structure > SDK > + > Python SDK > Navigate to the jython binary
查看更多
登录 后发表回答