简体   繁体   中英

jython setup in Eclipse/PyCharm

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.abc 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,

在此处输入图片说明 在此处输入图片说明

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

在此处输入图片说明

Edit 3 , cannot select installed jython interpreter from Eclipse, 在此处输入图片说明 在此处输入图片说明

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

在此处输入图片说明

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

在此处输入图片说明

在此处输入图片说明

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 your IDE 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 was File > Project Structure > SDK > + > Python SDK > Navigate to the Jython Binary

Also take some time to peruse the Jython Book .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM