I'm a newbie in running Java code in Linux environment. I'm trying to get the Astyanax to work on the linux machine.
I followed the instruction on https://github.com/Netflix/astyanax/wiki/Getting-Started
I have cloned the code from github, and ./gradlew build runs successfully.
I'm trying to run the AstClient in the astyanax-examples. I tried the following command:
java -cp "/home/shbash6/astyanax/astyanax-examples/build/libs/;/home/shbash6/astyanax/astyanax-cassandra/build/libs/;/home/shbash6/astyanax/astyanax-core/build/libs/;/home/shbash6/astyanax/astyanax-thrift/build/libs/" com.netflix.astyanax.examples.AstClient
under holder:
/home/shbash6/astyanax/astyanax-examples/build/classes/main
but I got the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com/netflix/astyanax/examples/AstClient
Caused by: java.lang.ClassNotFoundException: com.netflix.astyanax.examples.AstClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: com.netflix.astyanax.examples.AstClient. Program will exit.
Could anyone tell me how to fix this issue? Thanks!
Use : classpath separators on *nix platforms
java -cp "/home/shbash6/astyanax/astyanax-examples/build/libs/*:/home/shbash6/astyanax/astyanax-cassandra/build/libs/*:/home/shbash6/astyanax/astyanax-core/build/libs/*:/home/shbash6/astyanax/astyanax-thrift/build/libs/*" com.netflix.astyanax.examples.AstClient
Related
I have a maven project on a linux machine and it runs fine when I run mvn package from the linux machine itself. I can build the project and all the good stuff. But, when I ssh to the linux machine from my mac and browse to my maven project, the mvn package command gives me an error. I have pasted the error here -
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher. Program will exit.
I wrote some Java code that takes several arguments using Eclipse. I was able to compile and execute the code just fine by entering the arguments in the "Run configurations."
However, I need to be able to run my code via command-line. This is what I tried:
javac -g ./MyCode.java
java MyCode ./fileOne.txt ./fileTwo.txt ./fileThree.txt
And the error message:
Exception in thread "main" java.lang.NoClassDefFoundError: mypackage/MyCode
Caused by: java.lang.ClassNotFoundException: mypackage.MyCode
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I don't understand what is going on. My code does not have any bugs when I run through Eclipse. Help?
You are not setting up the classpath properly.
http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
I am having difficulty running JOGL on my mac. I am running Mac OSX 10.8.5. I followed the instructions given here:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Compile_and_run_your_project_from_the_command_line
First I downloaded jogamp-all-platforms.7z.
I copied the mac jogl jar files to /jogl2/jar, and I copied the contents of the lib folder to /jogl2/lib.
I copied gluegen-rt.jar and jogl-all.jar to /Library/Java/Extensions.
I then compiled a simple class with:
$ javac -classpath "/jogl2/jar/gluegen-rt.jar:/jogl2/jar/jogl-all.jar" /COM/Week1/JOGLtutorial/S1.java
It compiles with no errors. When trying to run the compiled program I get the following error:
$ java -classpath "/jogl2/jar/gluegen-rt.jar:/jogl2/jar/jogl-all.jar" -Djava.library.path="/jogl2/lib" /COM/Week1/JOGLtutorial/S1
Exception in thread "main" java.lang.NoClassDefFoundError: /COM/Week1/JOGLtutorial/S1
Caused by: java.lang.ClassNotFoundException: .COM.Week1.JOGLtutorial.S1
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could anyone enlighten me on my errors? I have it working fine on windows. I think the problem is something to do with incorrectly setting up environment variables.
I need to run a jar file in my macbook pro running Mountain Lion. But I can't run java from command line. It comes up with error when I tried to check java version or help command
Ashfaqur-Rahmans-MacBook-Pro:~ inganious$ java help
Exception in thread "main" java.lang.NoClassDefFoundError: help
Caused by: java.lang.ClassNotFoundException: help
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Please anyone help .
Thanks
java take class file name as its parameter. When you type java help, the JVM thinks help is a class file name, and it throws the NoClassDefFoundError exception because it doesn't find it.
What you are trying to do is using the help option.
java -help
this question is similiar to another question(http://stackoverflow.com/questions/11683802/cannot-run-play-framework-project-on-netbeans-7-2-ide)
When I use play-1.2.5, my project fail to run in Netbeans 7.
But when I change the play version to 1.2.4,it run success.
Here is the Exception when I run the project in netbenas 7 with play-1.2.5 framework
E:\play-1.2.5\id doesn't exist
Listening for transport dt_socket at address: 8000
java.lang.NoClassDefFoundError: ${jvm/memory}
Caused by: java.lang.ClassNotFoundException: ${jvm.memory}
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: ${jvm.memory}. Program will exit.
Exception in thread "main" Java Result: 1
add this to your application.conf
jvm.memory=-Xmx256M
Try increasing the heap size for the JVM.