By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

jpype._jexception.ExceptionPyRaisable: java.lang.Exception: Class XXX not found

P: 1
Hi,
i was looking for a way to call a java method from a python file, and i found that the "jPype" allows us to do that so i have installed it (on linux) and when looking for exemples on how to use it, i found this one in the net
the java file is:
#A.java
Expand|Select|Wrap|Line Numbers
  1. class A
  2. 02    {
  3. 03        public A()
  4. 04        {
  5. 05            super();
  6. 06        }
  7. 07        public String sayHi()
  8. 08        {
  9. 09            return("Hello");
  10. 10        }
  11. 11    }
  12.  
and the python file is:
#test.py
Expand|Select|Wrap|Line Numbers
  1. 1    import jpype
  2. 2    import os
  3. 3    jpype.startJVM("/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so", "-ea", "-Djava.class.path=%s"%os.path.abspath("."))
  4. 4    A = jpype.JClass("A")
  5. 5    a = A()
  6. 6    print a.sayHi()
  7. 7    jpype.shutdownJVM()
  8.  
i put the two files in the same directory but when compiling the test.py i got this error""jpype._jexception.ExceptionPyRaisable: java.lang.Exception: Class A not found"""


Please can any one help me :(.
Mar 5 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.