Prev: Using string as file
Next: ActiveX control in python vs ActiveX control in vb 6 (piece of code)
From: unlikeablePorpoise on 13 Aug 2007 17:21 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
From: Ian Clark on 13 Aug 2007 19:22 unlikeablePorpoise(a)gmail.com wrote: > 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 > Try this: com.JPypeTest.main("arg") Ian
From: unlikeablePorpoise on 14 Aug 2007 08:52 > > Try this: > com.JPypeTest.main("arg") > > Ian Thanks for your suggestion, but it doesn't work (produces an error). Does anybody else have any ideas? Thanks, Sarah
From: Laurent Pointal on 14 Aug 2007 09:03 unlikeablePorpoise(a)gmail.com a �crit : >> Try this: >> com.JPypeTest.main("arg") >> >> Ian > > Thanks for your suggestion, but it doesn't work (produces an error). This is where you should have copy/pasted the error. ;-) > > Does anybody else have any ideas? Sorry, no.
From: unlikeablePorpoise on 14 Aug 2007 09:20 Good point Laurent. Here is the error produced when I try to access main() using 'com.JPypeTest.main("arg")' The original code is pasted at the top of this thread. I only added 'com.JPypeTest.main("arg")' which causes the error below -------------ERROR_------------- File "tester.py", line 10, in <module> com.JPypeTest.main("arg") RuntimeError: No matching overloads found. at src/native/common/ jp_method.cpp:121 ----------END ERROR------------- Thanks, Sarah On Aug 14, 8:03 am, Laurent Pointal <laurent.poin...(a)limsi.fr> wrote: > unlikeablePorpo...(a)gmail.com a écrit : > > >> Try this: > >> com.JPypeTest.main("arg") > > >> Ian > > > Thanks for your suggestion, but it doesn't work (produces an error). > > This is where you should have copy/pasted the error. > > ;-) > > > > > Does anybody else have any ideas? > > Sorry, no.
|
Next
|
Last
Pages: 1 2 Prev: Using string as file Next: ActiveX control in python vs ActiveX control in vb 6 (piece of code) |