Msdos en java
genie-netcom
Messages postés
107
Statut
Membre
-
genie-netcom Messages postés 107 Statut Membre -
genie-netcom Messages postés 107 Statut Membre -
Bonjour à tous ,je veux lancer une commande cmd par un code java.le cose est le suivant:
import java.io.IOException;
public class msdos{
public msdos() {
}
public void delet (String path) throws IOException
{
String cmd = ("del "+path);
Runtime dos = Runtime.getRuntime();
dos.exec(cmd);
return;
//Thread.currentThread().g
}
public static void main(String[] args) throws IOException {
msdos ms = new msdos();
ms.delet("C:\\nn.txt");
}
}
il m'apparait les exeptions suivants je ne sais pas quel est l'erreur:
Exception in thread "main" java.io.IOException: Cannot run program "del": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at msdos.delet(msdos.java:12)
at msdos.main(msdos.java:20)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 6 more
import java.io.IOException;
public class msdos{
public msdos() {
}
public void delet (String path) throws IOException
{
String cmd = ("del "+path);
Runtime dos = Runtime.getRuntime();
dos.exec(cmd);
return;
//Thread.currentThread().g
}
public static void main(String[] args) throws IOException {
msdos ms = new msdos();
ms.delet("C:\\nn.txt");
}
}
il m'apparait les exeptions suivants je ne sais pas quel est l'erreur:
Exception in thread "main" java.io.IOException: Cannot run program "del": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at msdos.delet(msdos.java:12)
at msdos.main(msdos.java:20)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 6 more
A voir également:
- Msdos en java
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Waptrick java voiture - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages