Results 1 to 2 of 2
- 02-18-2009, 04:11 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 7
- Rep Power
- 0
Call java Methods from Python Script
Hi,
I am trying to call java methods from a python script. Jython is not an option. I have looked at using Jpype. Below is my code thus far:
Jpype.py
from jpype import *
startJVM("C:\Program Files\Java\jdk1.6.0_12\jre\bin\client", "-ea", "-Djava.class.path=%s" % classpath)
com =JPackage("CallJavaFromPython")
jp = com.Jpype1()
jp.printArgument("XXX")
shutdownJVM()
================================================== =
Jpype1.class
package CallJavaFromPython;
public class Jpype1 {
public static void main(String args[]){
System.out.println(args[0]);
}
public void printArgument(String arg){
System.out.println(arg);
}
}
================================================== =
Error message i am getting when I try to run the python script is :
NameError: name 'startJVM' is not defined
has anyone come across this before?
Thanks in advance...
- 02-18-2009, 04:47 PM #2
Similar Threads
-
[B] How to call Perl script from Java [/B]
By JavaEmpires in forum Advanced JavaReplies: 7Last Post: 12-19-2008, 03:10 PM -
Program To Call Random Methods
By nyamtoko in forum Advanced JavaReplies: 5Last Post: 12-01-2008, 11:49 AM -
How to call methods of different classes
By adeeb in forum New To JavaReplies: 2Last Post: 06-06-2008, 06:08 AM -
How can I call java class methods in Oracle 10g PL/SQL
By searcher34 in forum JDBCReplies: 0Last Post: 01-02-2008, 01:52 PM -
Calling Java methods form Python
By mew in forum Advanced JavaReplies: 1Last Post: 12-21-2007, 02:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks