Hi
I got some trouble with my program and I need help.
this is the code:
public void actionPerformed(ActionEvent arg0) {
Object source = arg0.getSource();
if (source == Button1) {
System.out.println("Player has choosen the button: " + "button1");
String EP = JOptionPane.showInputDialog("Please enter your file location");
String Path = EP;
String Location = Path + "\\test.exe";
System.out.printf("the path entered was: " + Location);
Runtime r= Runtime.getRuntime();
Process p= null;
try
{
p=r.exec(Location);
}
catch(Exception e){
System.out.println("error==="+e.getMessage());
e.printStackTrace();
}
}
if (source == Button2) {
}
if (source == ButtonBattle3) {
}
}
so everything works fine until I paste the location
it prints the location with spaces and all that but it will not start the program
it says that the file could not be found
there are some spaces in the path I enter so if the location is:
C:\test\test 01
it only takes
c:\test\test
so how can I fix this?