package javaapplication33;
import java.io.File;
import java.io.IOException;
public class JavaApplication33 {
public static void main(String[] args) throws IOException{
File happyFile = new File("/happy.txt");
if (happyFile.exists() == false) {
happyFile.createNewFile();
System.out.println("the file is created");
} else {
System.out.println("tHE FILE ALREADY EXSISTED ");
}
}
}
ici est mon erreur:Je suis en train d'enregistrer mon dossier sur le lecteur c et im obtenir une erreur
Exception in thread "main" java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at javaapplication33.JavaApplication33.main(JavaApplication33.java:14)
Java Résultat: 1
- J'ai essayé C: // & C:/cela ne fonctionnait toujours pas *
Avez-vous essayé un dossier dans C: \? comme C: \ Temp, peut être lié aux permissions (écrire dans le dossier racine). – Ofiris
si ce n'est pas nécessaire, n'utilisez pas le fichier C car il a besoin d'une autorisation. – pooyan
Très bien, cela a fonctionné. Merci de votre aide. – pur3extrme