我是新來的,學習Java。我試圖在Netbeans的7Java錯誤(包java.nio.file不存在import java.nio.file。*;)
import java.io.*;
import java.nio.file.*;
import java.nio.file.StrandardOpenOption.*;
public class FileOut
{
public static void main(String[] args)
{
Path file = Paths.get("C:\\Java\\Chapter.13\\Grades.txt");
String s = "ABCDF";
byte[] data = s.getBytes();
OutputStream output = null;
try
{
output = new BufferedOutputStream(file.newOutputStream(CREATE));
output.write(data);
output.flush();
output.close();
} catch (Exception e)
{
System.out.println("Message: " + e);
}
}
}
運行下面的應用程序,當我編譯應用程序,我得到了以下錯誤消息:
package java.nio.file does not exist import java.nio.file.*;
的錯誤顯示在這兩個系。
import java.nio.file.*;
import java.nio.file.StrandardOpenOption.*;
我需要做些什麼才能使其發揮作用?我將不勝感激任何幫助。
謝謝 喬
這與HTML或Ruby無關 - 請保持標記相關 –
環境變量中的CLASSPATH條目是什麼?它需要設置爲像'C:\ \ jdk1.7.0 \ bin' –