I try to using Runtime but have some problem. I want to use Runtime.exec("java -cp")
. One is jar file, another is class file. Class file is refer to jar file but not included. Below is my code
Runtime rt = Runtime.getRuntime();
Process proc = null;
System.out.println(Run.class.getResource("").getPath());
try {
proc = rt.exec("java -cp c:/data/hh.jar; com/list/shark/Whale");
} catch (IOException e1) {
e1.printStackTrace();
}
Result is "could not find or load default class". I really want to know that where is location executing runtime and how sole this problem.
PS In local cmd, command is working.