简体   繁体   中英

Java FileNotFoundException in Ubuntu 12.04?

I have ubuntu 12.04 where i have installed JDK 7 , Jboss Server AS 7.1.1 and running my application successfully.The problem is in my java application i am editing a xml file at runtime to update the content of file. It is working fine in window but in ubuntu it is throwing FileNotFoundException.

But i checked manually file is there.

Can you please help me . Is it like you can't change files at run time in ubuntu or some admin privileges.

Caused by: java.io.FileNotFoundException: /home/azureuser/ranveer/hopscotch/jboss-as-7.1.1.Final/standalone/deployments/Hop.ear/entre.war/config/datacon/DaoConfig.xml (No such file or directory) 04:04:33,219 ERROR [stderr] (http--0.0.0.0-8080-5) at java.io.FileInputStream.open(Native Method) 04:04:33,219 ERROR [stderr] (http--0.0.0.0-8080-5) at java.io.FileInputStream.(FileInputStream.java:146) 04:04:33,220 ERROR [stderr] (http--0.0.0.0-8080-5) at java.io.FileInputStream.(FileInputStream.java:101) 04:04:33,220 ERROR [stderr] (http--0.0.0.0-8080-5) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90) 04:04:33,220 ERROR [stderr] (http--0.0.0.0-8080-5) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188) 04:04:33,220 ERROR [stderr] (http--0.0.0.0-8080-5) at java.net.URL.openStream(URL.java:1037) 04:04:33,221 ERROR [stderr] (http--0.0.0.0-8080-5) ... 118 more

I'd triple-check the existence of the file, taking into account case sensitivity (especially since you mentioned it works on windows). Also according to documentation the exception name is misleading: it could indicate other problems eg permissions or having a directory instead of a file.

http://docs.oracle.com/javase/7/docs/api/java/io/FileInputStream.html#FileInputStream(java.io.File)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM