« Return to Thread: JPype // TypeError // Getting it to work with Jar file for first time

Re: JPype // TypeError // Getting it to work with Jar file for first time

by Steve Ménard :: Rate this Message:

| View in Thread

I think I got it :)

It's really one of those very small details ...

   import jpype
   jvmPath = "C:/Program Files/Java/jdk1.5.0_13/jre/bin/client/jvm.dll"
   options = "-ea"
   jarPath = "-DJava.class.path=C:/Python26/junkTest.jar"
   jpype.startJVM(jvmPath,options, jarPath)

I believe the problem is here : -DJava.class.path

java's system variable are case-sensitive ... so the J would be a problem (I checked, the capital J was also in your first example).

try with -Djava.class.path and with some luck that'll solve your problem.

Steve Menard

------------------------------
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
    Rick Cook, The Wizardry Compiled
------
There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence.
-- Jeremy S. Anderson


On Tue, Jan 18, 2011 at 5:39 PM, plovet <tr03@...> wrote:

Dear Steve, Raj,

Below is my result of my trying to use JClass.

It is clear that the class is not being found, but I am at a loss to
explain.

FYI, I also tried changing the options to the use the java options that I
typically use when accessing a jar file via a batch file. (I do not see that
it makes any difference)


Thanks,
Timothy


----------Error Message---------
Warning (from warnings module):
 File "C:\Python26\lib\site-packages\jpype\_pykeywords.py", line 18
   import sets
DeprecationWarning: the sets module is deprecated

Traceback (most recent call last):
 File "C:/Python26/testPype3a.py", line 11, in <module>
   myClass = jpype.JClass(className)
 File "C:\Python26\lib\site-packages\jpype\_jclass.py", line 54, in JClass
   raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
java.lang.ExceptionPyRaisable: java.lang.Exception: Class junkTest.TestSteam
not found


----------Python Code---------
#testPype3a.py
import jpype

jvmPath = "C:/Program Files/Java/jdk1.5.0_13/jre/bin/client/jvm.dll"
options = ("-Xms64m", "-Xmx512m", "-cp") #  "-ea"
jarPath = "-DJava.class.path=C:/Python26/junkTest.jar"

jpype.startJVM(jvmPath,options, jarPath)
className="junkTest.TestSteam"
myClass = jpype.JClass(className)
myInstance = myClass()


----------Jar File---------
I used the new jar file in my C:\Python26 folder (see prev. post).

--
View this message in context: http://old.nabble.com/JPype----TypeError----Getting-it-to-work-with-Jar-file-for-first-time-tp30703870p30705100.html
Sent from the jpype-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Jpype-users mailing list
Jpype-users@...
https://lists.sourceforge.net/lists/listinfo/jpype-users


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Jpype-users mailing list
Jpype-users@...
https://lists.sourceforge.net/lists/listinfo/jpype-users

 « Return to Thread: JPype // TypeError // Getting it to work with Jar file for first time