ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: JPype - passing to Java main
by Ian Clark other posts by this author
Aug 13 2007 5:08PM messages near this date
JPype - passing to Java main | Re: Finding gurus (was Re: Something in the function tutorial confused me.)
unlikeablePorpoise@[...].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

-- 
http://mail.python.org/mailman/listinfo/python-list
Thread:
unlikeablePorpoise
Ian Clark

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved