Reputation: 3033
I am using Python in Google App Engine and I have a Java class library that I want to use in my program...
Is there a way to import that library and use it in a python program?
I have searched the net and found something like this:
from jpype import *
import re
import string
startJVM("/opt/sun-jre/lib/i386/client/libjvm.so", "-Djava.class.path=/home/talat/zemberek-0.6.4.jar", "-ea")
zerisim = JPackage('net').zemberek.erisim.Zemberek
But I am not sure whether "jpype" can be used in Google App Engine...
Thank you,
Upvotes: 0
Views: 250
Reputation: 14187
If the java functionality is critical to your application and not easy to rewrite in python, then you could write a simple web app in java that uses the library, and run that on appengine as a separate version than your main python app. You could then call the java app from the python app using HTTP. This is not an elegant solution, but if you really need the functionality, it should get the job done. The key here is that app engine will let you run more than one "version" of your app at a time, including different runtimes.
Upvotes: 1
Reputation: 24966
There is no way at present on App Engine to import or otherwise access Java libraries from Python. Jython might be an approach worth trying (using the Java GAE SDK), though I'm not aware of anyone having gone that route before.
Upvotes: 0