我想在我的应用程序路径中添加一个外部jar,这是我的代码,但它没有用。
代码:
final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
File Jar = null;
try {
Jar = new File(MyApp.class.getProtectionDomain().getCodeSource().getLocation().toURI());
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
final ArrayList<String> command = new ArrayList<String>();
command.add(javaBin);
command.add("-classpath");
command.add("\""+"C:\\path to file\\file.jar"+"\""+" ");
command.add(Jar.getPath());
Restart();