I have a class that is written in Java.
Can it be used in Python so i dont have to rewrite it?
-
3Wait, wat? You'll have to clarify... extensively. Run Python on a JVM (in that case, Jython is the answer)? Generate Java code from Python? [enter another interpretation here]?– user395760Commented Dec 10, 2010 at 22:16
-
2I have a class that is written in Java. Can it be used in Python so i dont have to rewrite it?– user538442Commented Dec 10, 2010 at 22:17
-
Thanks. So Jython is indeed the answer.– user395760Commented Dec 10, 2010 at 22:20
-
Thanks! Seems to do exactly what I need.– user538442Commented Dec 10, 2010 at 22:23
-
3Ummm ... if the class is 1800 lines long, may be it needs to be rewritten.– Stephen CCommented Dec 10, 2010 at 22:49
|
Show 3 more comments
2 Answers
JYthon is a python implementation in java , you should check it out
www.jython.org
-
Yes, this is interesting. I will have to investigate this Commented Dec 10, 2010 at 22:20
See this: http://jpype.sourceforge.net/
Might not be worth the trouble, though..
-
I have a class that is already written in Java. I need to use python for this particular project. It would be a pain to have to rewrite it in Python. This is also a very interesting response. I need to investigate this. Seems like there might be quite a bit of overhead associated with it though Commented Dec 10, 2010 at 22:21
-
What i meant by 'not be worth the trouble' is that rewriting the class just might be the simplest solution. Keep in mind the way you python code should be deployed. If you use your Java class, it requires you to install and deploy at least JRE Commented Dec 10, 2010 at 22:29
-
True, that is a good point. It would be rather time consuming to rewrite it though and debug it. This is definitely interesting though. i am going to explore this and Jython before I begin anything Commented Dec 10, 2010 at 22:32