When I'm using -classpath in example 1 to execute my java application from another directory, it shows error unsatisfied link error. such as
error:
java.lang.UnsatisfiedLinkError: no <java main classname> in java.library.path
example1:
java -Djava.library.path=. -classpath ".:<.jar files path>:</java application directory/>" <java main class name>
But when I run example2 command in any random directory in the /home/root/,
it is running my java application.
example2:
java -Djava.library.path=. -cp ".:<.jar files path>:</java application directory/>" <java main class name>
hence I just want to what is the difference between -classpath and -cp.
My code example
class enGraph{
static {
/*
* Load native library libepdgraph.so (Unixes) at runtime This library contains
* a native method called button()
*/
File lib = new File("/home/root/" + System.mapLibraryName("enGraph"));
System.load(lib.getAbsolutePath());
}
}