Integrating Java and Python code in one Eclipse project

I am writing a compiler in Python using Eclipse with PyDev. I came to a scene where I needed to write Java code. I am wandering if there is a way to combine them into one project because at the moment I have two separate projects and whenever I need to change my Java code I have to manually copy the .class file into the Python project.

If this is not possible, what would you suggest is the most elegant way to structure the files of these projects and how should I customize the build process?

Thank.

+3


source to share


2 answers


You can keep things in separate projects without having to copy the .class files to the Python project, provided that you create the project as a PyDev project and add the location that contains the .class files (i.e.: bin folder) as the source folder in the PyDev config (and a link to this project from a Python project).

Take a look at "Project Link for Jython Users" (at the end of http://pydev.org/manual_101_project_conf2.html ).



I think you could also do what you asked in your question: create a java project, set it up as a PyDev project (right click on this project> pydev> set as a pydev project) and set the properties of the PyDev project by setting PYTHONPATH to the location where you have your Python files and add another entry to the folder bin

(i.e.: where the .class files exist). Not sure if it would be better to keep them as two separate projects.

+3


source


I think Jython would be perfect here, as the Python code is essentially translated into Java bytecode and run in the Java virtual machine, making it easy to communicate between the two. Also, pydev itself integrates well with Jython.



0


source







All Articles