mercredi 15 novembre 2017

cant acces class file because of classpath

I'm trying to run a program that uses the classpath to access classes in another directory.

Currently, when I run the project, I get the following error:

java.lang.ClassNotFoundException: Cat

This is occurring when I try to load the class:

Class c = Class.forName(classList.get(i-1));  //Class c = Class.forName("Cat"));
Method[] methods = c.getMethods();

Below are the two approaches I'm using for setting the classpath but both approaches result in the same error:

export CLASSPATH=.:/Users/john/Desktop/TestClass/
java -classpath .:/Users/john/Desktop/TestClass ProjectDemo /Users/john/Desktop/TestClass





Aucun commentaire:

Enregistrer un commentaire