Home > Back-end >  Through the Java execution error for the desktop shortcut
Through the Java execution error for the desktop shortcut

Time:12-21

code below :
 public class CMDUtil {
Public static void main (String [] args) {
String name="C: \ \ Users \ \ 2333 \ \ Desktop \ \ B station recorded her. LNK";
The ProcessBuilder pb=new ProcessBuilder (name);
Try {
Process Process=pb. Start ();
} the catch (IOException e) {
//TODO to automatically generate the catch block of
e.printStackTrace();
}



}
}



run after an error:
Java. IO. IOException: always run the program "C: \ Users \ Desktop \ B station recorded her. LNK" : CreateProcess error=193, % 1 is not a valid Win32 application,
The at Java. Lang. ProcessBuilder. Start (ProcessBuilder. Java: 1048)
At network boot. CMDUtil. Main (CMDUtil. Java: 17)
Under Caused by: Java. IO. IOException: CreateProcess error=193, % 1 is not a valid Win32 application,
The at Java. Lang. ProcessImpl. Create (Native Method)
The at Java. Lang. ProcessImpl. & lt; init> (ProcessImpl. Java: 444)
The at Java. Lang. ProcessImpl. Start (ProcessImpl. Java: 140)
The at Java. Lang. ProcessBuilder. Start (ProcessBuilder. Java: 1029)
. 1 more





but there is no problem running exe program :
 public class CMDUtil {
Public static void main (String [] args) {
String name="A: \ \ Tencent \ \ TIM \ \ Bin \ \ QQScLauncher exe";
The ProcessBuilder pb=new ProcessBuilder (name);
Try {
Process Process=pb. Start ();
} the catch (IOException e) {

e.printStackTrace();
}



}
}

can you tell me the bosses should change
  • Related