0

I just found out about Jython and I really wanted to use it. Please forgive me if I'm doing something wrong and please explain. I made a simple python program to test Jython, test.py. When typing

jython test.py

in the command prompt it run normally. So I decided to make a Java .class file. Since jythonc doesn't exist anymore, I tried

jython -m py_compile test.py

and a .class file was created in the same directory called test$py.class. (this is equivalent to

>>> import py_compile
>>> py_compile.compile('test.py')

as I tried as well)

However, when I tried

java test$py

it threw me an exception:

Error: Could not find or load main class test$py
Caused by: java.lang.NoClassDefFoundError: org/python/core/PyRunnable

(I also tried with classpath but it did the same exception)

What does it mean? How can I solve it?

Note: I've downloaded Jython 2.5.4rc1.

Bluberry17
  • 21
  • 1
  • 6
  • 2.5.4rc1 is quite old. The latest release is 2.7.1: https://jython.github.io/download – mzjn Jan 07 '19 at 12:36
  • I'll try it, thanks. I downloaded the above version because I thought 2.7.0 was the latest. It didn't work on my computer so I chose an older version. – Bluberry17 Jan 07 '19 at 12:39
  • I just downloaded it and tried it. It still doesn't work... I also noticed the directory path C:\jython2.7.1\tests\java\org\python\core and there is nothing called PyRunnable. So I guess that's the issue? – Bluberry17 Jan 07 '19 at 12:57
  • I think you need jython.jar in the classpath. https://stackoverflow.com/a/15446116/407651 – mzjn Jan 07 '19 at 13:17
  • @mzjn Thanks, it works that way. – Bluberry17 Jan 07 '19 at 13:24

1 Answers1

0

This could be a corrupted installation of jython as per simillar Linux: NoClassDefFoundError org/python/core/PyException #1006 issue. If you can find jython-standalone-2.5.3.jar and it's not corrupted you may want to try re-downloading and re-installing jython.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111