Reputation: 718
I have a class in java:
public class MyClass{
public String a=null;
public String b=null;
public String c=null;
public String d=null;
public static String testMyClass() {
//my method instruction using the attributes a,b,c and d
}
The trouble is that MyClass
attributes must be received from python to be able to use the method testMyClass
. So is it possible to instantiate a java class from python and after send it back to java using py4j?
Anyone can show how to make it if it is possible? Or have another alternative?
Upvotes: 1
Views: 186
Reputation: 2245
I don't think that is possible unless someone knows of a "bridge" utility between Java and Python.
However, you may do this:
MyClass
MyClass
using Jackson or some JSON tool.Your next problem will be the communication between you Java process and Python process. For that, see if this StackOverflow question helps: Passing data from Java process to a python script
Upvotes: 2