I installed jython 2.7 beta 1 on Windows and copied its JYTHON_HOME/bin/jython
shell script into a $PATH
-visible location for MSYS, but calling
$ jython
doesn't work, with this error:
java.lang.NoClassDefFoundError: org/python/util/jython
Caused by: java.lang.ClassNotFoundException: org.python.util.jython
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.python.util.jython. Program will exit.
Exception in thread "main"
Having a look at this jython
shell script (which I renamed jython.sh
), I see it expects either Cygwin or Darwin.
At the beginning of the file I added
export JAVA_HOME='/c/Programs/JavaRE/6u31'
export JYTHON_HOME='/c/Programs/jython2_7b1'
And then where it said
case "`uname`" in
CYGWIN*) cygwin=true;;
Darwin) darwin=true;;
esac
I replaced with
case "`uname`" in
CYGWIN*) cygwin=true;;
MINGW*) cygwin=true;;
Darwin) darwin=true;;
esac
But it still doesn't work, with:
$ jython.sh test.j.py
/c/Programs/Path/jython.sh: line 265: /cygdrive/c/Programs/JavaRE/6u31/bin/java: No such file or directory
Internally the jython.sh
script uses cygpath
, but MSYS doesn't have that, so it falls back on Cygwin's, leading to the above error. How to resolve this?