I am trying to get JPype to pass a String into a Java class main
function. Demonstration code below:
=============JA VA============
package com;
public class JPypeTest {
public static void main(String args[]) {
System.out.prin tln(args[0]);
}
public void printArgument(S tring arg) {
System.out.prin tln(arg);
}
}
===========PYTH ON===========
from jpype import *
startJVM("C:/Program Files/Java/jdk1.5.0_12/jre/bin/server/jvm.dll","-
Djava.class.pat h=C:/jpypetest/test/")
com = JPackage("com") ;
jp = com.JPypeTest() ;
jp.printArgumen t('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 6 4817 un************* ***@gmail.com wrote:
I am trying to get JPype to pass a String into a Java class main
function. Demonstration code below:
=============JA VA============
package com;
public class JPypeTest {
public static void main(String args[]) {
System.out.prin tln(args[0]);
}
public void printArgument(S tring arg) {
System.out.prin tln(arg);
}
}
===========PYTH ON===========
from jpype import *
startJVM("C:/Program Files/Java/jdk1.5.0_12/jre/bin/server/jvm.dll","-
Djava.class.pat h=C:/jpypetest/test/")
com = JPackage("com") ;
jp = com.JPypeTest() ;
jp.printArgumen t('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.m ain("arg")
Ian
>
Try this:
com.JPypeTest.m ain("arg")
Ian
Thanks for your suggestion, but it doesn't work (produces an error).
Does anybody else have any ideas?
Thanks,
Sarah un************* ***@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.
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.m ain("arg")
RuntimeError: No matching overloads found. at src/native/common/
jp_method.cpp:1 21
----------END ERROR-------------
Thanks,
Sarah
On Aug 14, 8:03 am, Laurent Pointal <laurent.poin.. .@limsi.frwrote :
unlikeablePorpo ...@gmail.com a écrit :
Try this:
com.JPypeTest.m ain("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.
-------------ERROR_-------------
File "tester.py" , line 10, in <module>
com.JPypeTest.m ain("arg")
RuntimeError: No matching overloads found. at src/native/common/
jp_method.cpp:1 21
----------END ERROR-------------
I haven't used jpype, but the signature for java main functions is
public static void main (String [] args)
So try com.JPypeTest.m ain(["arg"])
Note the addition of square brackets to create a *list* of arguments,
which presumably jpype will transform into a java String[].
Alan.
In article <11************ *********@d55g2 000hsg.googlegr oups.com>,
<un************ ****@gmail.comw rote:
>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.m ain("arg") RuntimeError : No matching overloads found. at src/native/common/ jp_method.cpp: 121 ----------END ERROR-------------
Thanks, Sarah
Just a guess, but try com.JPypeTest.m ain(["arg"]).
Gary Duzan
Motorola HNM
>On Aug 14, 8:03 am, Laurent Pointal <laurent.poin.. .@limsi.frwrote :
>unlikeablePorp o...@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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: F. GEIGER |
last post by:
I've dev'ed a Python prototype of an app, that besides the internals making
it up has a gui. While test-driven dev'ing the app's internals in Python is
fun as usual, dev'ing the GUI is not so funny, at least for me.
I guess dev'ing a GUI in a test-driven way is not possible, or is it? I'm
using wxPython, so if anyone has an idea...
For now most of the time I extend and change the gui things, then run it, do
the clicks to go thru the...
|
by: Joachim Boomberschloss |
last post by:
Hello,
I am working on a project in Python, and I"m
currently
looking into the possibiliy of writing some of the
project"s modules in Java. Given that a large part of
the code is already written in Python, using the
standard libraries and several extension modules, I
am
trying to gauge the viability of integration with
|
by: Jim Hargrave |
last post by:
I've read that it is possible to compile jython to native code using
GCJ. PyLucene uses this approach, they then use SWIG to create a Python
wrapper around the natively compiled (java) Lucene. Has this been done
before for with jython?
Another approach would be to use JPype to call the jython jar directly.
My goal is to be able to script Java code using Jython - but with the
twist of using Cpython as a glue layer. This would allow...
|
by: skn |
last post by:
Hello,
I have written a very simple java class file, which invokes a Python script
using JEP.
Code snippet:-
-------------------
Jep jep = new Jep(false);
jep.runScript("C:\\temp\\testscript.py");
jep.close();
|
by: skn |
last post by:
Hello,
Is there any option to suppress the JVM activity report that gets displayed,
when you execute Java APIs from within Python using JPype.
E.g.,
JVM activity report :
classes loaded : 26
JVM has been shutdown
| |
by: benchline |
last post by:
I have been trying out jpype for python to java work and love it. It
works great on my gentoo box with the java 1.4.2 blackdown sdk.
I am now trying it on Red Hat Enterprise Linux 3 for access to business
intelligence tools (JasperReports, Mondrian, Pentaho, etc) for which we
don't have analogous tools in cpython yet. My idea it to use jpype in
a cherrypy application server to tie these java BI tools into a website
interface without...
|
by: kelemen.viktor |
last post by:
Hello!
Im a quite newbie in the python world.
I have some problem with packages, i installed the jpype package
according to its intructions.
To test ive written:
everything worked correctly but when i wrote a short script:
"
from jpype import *
|
by: oyster |
last post by:
As you may know, there is no beautiful and free chart(not plot, you
can find the examples at http://www.jfree.org/jfreechart,
http://www.rmchart.com) module for python than runs on
windows/linux/mac osx.
On the other hand, there is a living
package(http://www.jfree.org/jfreechart) for java, and it is nice. So
what about make the interface to JFreeChart via
jpype(http://jpype.sourceforge.net), or rewrite JFreeChart in and for
Python to...
|
by: RC |
last post by:
Dear Python Experts/Programmers,
I'm going to write a Python program to
access some Java class methods from our *.jar
file.
In your opinion, which way is the good (not the best)
way to do that?
JPype?
http://sourceforge.net/projects/jpype
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |