简体   繁体   English

java.io.FileNotFoundException:..(无此类文件或目录)

[英]java.io.FileNotFoundException: .. (No such file or directory)

I had developed a Java project correctly working on Eclipse under Windows OS. 我已经开发了一个Java项目,可以在Windows OS下在Eclipse上正常工作。 Then I wanted to switch to Ubuntu. 然后我想切换到Ubuntu。 I just took the full workspace folder (included all resources file required for the running) from Windows and imported it in the Ubuntu's Eclipse. 我只是从Windows中获取了完整的工作区文件夹(包括运行所需的所有资源文件),并将其导入了Ubuntu的Eclipse。

Most surprisingly I get the following exception: 最令人惊讶的是,我得到以下异常:

[ Test ] ERROR: unable to create myClass object. 
Check your implementation requirements!
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at Test.main(Test.java:183)
Caused by: java.io.FileNotFoundException: raw\file1.txt (No such file or directory)
...

but such directory and such file do actually exist in the current path. 但是这样的目录和文件实际上确实存在于当前路径中。

Why may this happen? 为什么会发生这种情况?

在任何项目中都使用File.separator而不是"/"

使用正斜杠“ /”,因为它在Windows和非Windows平台的文件路径中都可以使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.FileNotFoundException:没有这样的文件或目录错误 - java.io.FileNotFoundException: No such file or directory Error java.io.FileNotFoundException:[文件路径](没有这样的文件或目录) - java.io.FileNotFoundException: [filepath] (No such file or directory) java.io.FileNotFoundException(是一个目录) - java.io.FileNotFoundException (Is a directory) java.io.IOException:java.io.FileNotFoundException :(无此类文件或目录) - java.io.IOException: java.io.FileNotFoundException:(No such file or directory) java.io.FileNotFoundException没有此类文件或目录错误,但目录存在 - java.io.FileNotFoundException No such file or directory error but directory exists Linux java没有此类文件或目录,java.io.FileNotFoundException: - Linux java No such file or directory, java.io.FileNotFoundException: Java FileWriter 类 - java.io.FileNotFoundException: * 没有这样的文件或目录 -Ubuntu - Java FileWriter class - java.io.FileNotFoundException: * no such file or directory -Ubuntu java.io.FileNotFoundException(没有这样的文件或目录) - 下载文件 - java.io.FileNotFoundException (No such file or directory) - Download File java.io.FileNotFoundException:(无此类文件或目录)-使用servlet - java.io.FileNotFoundException: (No such file or directory) - Working with servlets 尝试访问.wav文件时java.io.FileNotFoundException(不是目录) - java.io.FileNotFoundException (Not a directory) when attempting to access a .wav file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM