首页 \ 问答 \ Android错误 - 打开失败的ENOENT(Android Error - Open Failed ENOENT)

Android错误 - 打开失败的ENOENT(Android Error - Open Failed ENOENT)

我正在尝试使用一个整数数组来保存一些块覆盖,这个数组只需保存执行一个块的次数。 由于某种原因,当我尝试写一些我创建的文件(例如,“BlockForHelper.txt”,我在Eclipse中专门指定并放在项目目录中)时,我收到此错误:

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

并给我错误:

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();
    }
}

任何人都知道可能是什么原因造成的?


I am trying to save some block coverage using an array of integers that simply saves the number of times a block is executed. For some reason, though, when I try and write to some files that I created ("BlockForHelper.txt" for example, which I made specifically in Eclipse and placed in the project directory), I get this error:

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

and gives me the error:

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();
    }
}

Anyone know what might be causing this?


原文:https://stackoverflow.com/questions/11620641
更新时间:2023-05-17 07:05

最满意答案

我一直在想最近的事情。 我能想出的最佳方法是在页面上放置几个“区域”。 在我的情况下,这些是3列。 我给每个标识符,并在每次将块移动到不同的位置以更新该块的新位置时使用Ajax调用。

例如,一个示例数据库表:

tbl.blocks:
  userid | blockid | column | placement
     1   |    2    |   1    |     3

其中,列是简单的列标识符,布局是该列中的布局。 我在页面加载时使用了一个查询,按照展示位置顺序加载这些块,然后将它们blockid指的是一个块表。

以下是我看到的相关教程: http : //aymanh.com/drag-drop-portal-interface-with-scriptaculous


I've been thinking about something similar recently. The best method I could come up with was to have several 'zones' on the page where items would be placed. In my case these were 3 columns. I gave each an identifier and used an Ajax call every time a block was moved to a different position to update the new position of that block.

For example, a sample database table:

tbl.blocks:
  userid | blockid | column | placement
     1   |    2    |   1    |     3

Where column is a simple column identifier and placement is the placement within that column. I used a query at page load that loaded the blocks in order of placement, and then wrote them in. blockid refers to a table of blocks.

Here's a tutorial I found that looks relevant: http://aymanh.com/drag-drop-portal-interface-with-scriptaculous

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)