JPype - passing to Java main
unlikeablePorpoise at gmail.com
unlikeablePorpoise at gmail.com
Mon Aug 13 17:21:10 EDT 2007
I am trying to get JPype to pass a String into a Java class main
function. Demonstration code below:
=============JAVA============
package com;
public class JPypeTest {
public static void main(String args[]) {
System.out.println(args[0]);
}
public void printArgument(String arg) {
System.out.println(arg);
}
}
===========PYTHON===========
from jpype import *
startJVM("C:/Program Files/Java/jdk1.5.0_12/jre/bin/server/jvm.dll","-
Djava.class.path=C:/jpypetest/test/")
com = JPackage("com");
jp = com.JPypeTest();
jp.printArgument('XXXX');
#WANT TO CALL main("arg") HERE!!!!
shutdownJVM()
===============================
What I want is to be able to call main() with an argument from the
python file (using JPype) and have it echo
args[0]. I can get this to work for printArgument(), but not for
main().
Thanks,
Sarah
More information about the Python-list
mailing list