[Py4j-users] How to run Stack example in the docs?
Status: Beta
Brought to you by:
barthe
From: listserve <tom...@gm...> - 2014-12-08 16:39:16
|
Hello, I'm trying to run the code in the docs from here: http://py4j.sourceforge.net/getting_started.html#writing-the-java-program I'm not that experienced with Java so I may very well be making a mistake unrelated to py4j, but I'm unable to run the code regardless. This is what I've done: I saved the Stack code in a file called Stack.java and the other code in StackEntryPoint.java. I compiled it at the command line with the following: JARFILE=/usr/local/share/py4j/py4j0.8.2.1.jar javac -cp $JARFILE *.java That gave no error. I then tried to run it with: java -cp $JARFILE:. StackEntryPoint and I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: StackEntryPoint (wrong name: py4j/examples/StackEntryPoint) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) I am running Linux Mint 17 (which is basically Ubuntu) and the following is my versions of java/javac: $ java -version java version "1.7.0_65" OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode) $ javac -version javac 1.7.0_65 Thanks for any help. Cheers, Thomas |