Question

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!

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top