javapythoninvokeresearchkitmindwave

How to call a java program automatically using a python script?


I am working on a research project that involves dealing with an EEG headset Device. The functional code and logic for the device (Mindwave Neursky EEG Headset) is completely documented in java so I have coded the whole project in java and the GUI is made with JavaFX. But as the research involves some other functionalities such as face data capturing, the other parts of the project ( The ML-based part) are coded in python. Now I need a way to interact with the java program through a python script. Namely, I want something like: When a python program is run, it automatically invokes the java program on my pc to run also.

A simple call just: Run the python code -> Java code automatically runs.

Thanks for any suggestion.


Solution

  • You can execute literally any command you want from python with the os module.

    READ HERE

    So in your case, you can do something like os.system(command) Read Here

    os.system('java <your_java_class>.java')