My Problem is, that i can't open a jar in a Java Program. The .jar that i want to open, has a OpenCV library in it. If i double Click the .jar, then it work fine. If I Type it in the Mac OS X terminal it works fine aswell.
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() instanceof JButton){
JButton button = (JButton) e.getSource();
if(button.getText().equals("Aktivieren")){
System.out.println("Yaay");
String str;
if(Main.os.contains("Mac")){
str = "java -jar "+System.getProperty("user.home") + "/Library/Application\\ Support/MW"+"/System/Core.jar";
System.out.println(str);
} else {
str = "java -jar "+Main.directory+"/MW/System/Core.jar";
}
System.out.println(str);
try {
Runtime.getRuntime().exec(str);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
So the output of the Sysout is: java -jar /Users/Tech/Library/Application\ Support/MW/System/Core.jar
And when i paste it manually in the Terminal it works just fine.
And I get no Error Messages.
Sorry for my Bad English, im german.
Thanks (or whatever) Tech