Tôi đang cố lưu một số phạm vi chặn bằng cách sử dụng một dãy số nguyên chỉ đơn giản là tiết kiệm số lần khối được thực thi. Tuy nhiên, vì lý do nào đó, khi tôi cố gắng viết một số tệp mà tôi đã tạo (ví dụ: BlockForHelper.txt), tôi đã tạo ra trong Eclipse và đặt trong thư mục dự án, tôi nhận được lỗi này:Lỗi Android - Mở Không thành công ENOENT
java.io.FileNotFoundException: /nfs/guille/groce/users/nicholsk/workspace3/SQLTest/BlockForTest: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
at com.example.sql2.SQLTest.blockCoverage(SQLTest.java:149)
at com.example.sql2.test.SQLTestCase.testSuite(SQLTestCase.java:41)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
... 18 more
và cung cấp cho tôi lỗi:
public void blockCoverage() throws IOException
{
String coverage = "";
for (int x = 0; x < 20; x++)
coverage += x + " " + bb_count[x] + "\n";
File file = new File("/nfs/guille/groce/users/nicholsk/workspace3/SQLTest/BlockForTest.txt");
Writer out = new OutputStreamWriter(new FileOutputStream(file)); // Here
try
{
out.write(coverage);
} finally {
out.close();
}
}
Bất kỳ ai biết điều gì có thể gây ra điều này?
Bạn đã đặt tệp txt này vào thư mục nào trong nhật thực? –
Chỉ thư mục gốc của dự án của tôi. Tại sao? – NioShobu
Tôi gặp sự cố này. Tôi đã xóa thư mục được tạo lập trình và tạo thủ công và giải quyết vấn đề !!! – breceivemail