0
Мой файл JarNoClassDefFoundError но класс присутствует
командаcassandra-driver-core-2.1.0.jar
Мои Javap для com/datastax/driver/core/Cluster
javap -classpath cassandra-driver-core-2.1.0.jar com/datastax/driver/core/Cluster
Это показывает
public class com.datastax.driver.core.Cluster implements java.io.Closeable {
final com.datastax.driver.core.Cluster$Manager manager;
protected com.datastax.driver.core.Cluster(java.lang.String, java.util.List<java.net.InetSocketAddress>, com.datastax.driver.core.Configuration);
protected com.datastax.driver.core.Cluster(com.datastax.driver.core.Cluster$Initializer);
public com.datastax.driver.core.Cluster init();
public static com.datastax.driver.core.Cluster buildFrom(com.datastax.driver.core.Cluster$Initializer);
public static com.datastax.driver.core.Cluster$Builder builder();
...............
Мой файл Java является
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Host;
import com.datastax.driver.core.Metadata;
public class SimpleClient {
private Cluster cluster;
public void connect(String node) {
System.out.println("I am in");
cluster = Cluster.builder().addContactPoint(node).build();
//ERROR
}
public void close() {
cluster.close();
}
public static void main(String[] args) {
SimpleClient client = new SimpleClient();
System.out.println("Obj Created");
client.connect("127.0.0.1");
// client.close();
}
}
Моя команда компиляции является
javac -classpath cassandra-driver-core-2.1.0.jar SimpleClient.java
Моя команда Run
tried1: java -classpath cassandra-driver-core-2.1.0.jar SimpleClient
Говорит
Could not find or load main class SimpleClient
Но класс присутствует.
Tried2: java -classpath SimpleClient
Это говорит
Obj Created
I am in
Exception in thread "main" java.lang.NoClassDefFoundError: com/datastax/driver/core/Cluster
at SimpleClient.connect(SimpleClient.java:12)
at SimpleClient.main(SimpleClient.java:29)
Caused by: java.lang.ClassNotFoundException: com.datastax.driver.core.Cluster
Пожалуйста, дайте мне знать решение.