TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   Java:FileNotFoundException (http://forums.techarena.in/software-development/1249257.htm)

Rail racer 21-09-2009 03:31 PM

Java:FileNotFoundException
 
When I tried to run .javac files in the java environment the compiler gives me the following error message, the strange problem is that it compiles .java file but when I run the .javac file it gives me following error.

java.io.FileNotFoundException: /sites/myproject/reports/jrxml/Test1.txt (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.j ava:179)
at java.io.FileOutputStream.<init>(FileOutputStream.j ava:70)

Khushal 21-09-2009 03:37 PM

Re: Java:FileNotFoundException
 
This exception will be thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file with the specified pathname does not exist. Check whether you have set the file path as C:\\Documents and Settings\\Collin\\My Documents\\NetBeansProjects\\Yahtzee\\src\\yahtzee path in the classpath? It will also be thrown by these constructors if the file does exist but for some reason is inaccessible.

napoleon 21-09-2009 03:40 PM

Re: Java:FileNotFoundException
 
public FileNotFoundException(String s)

Constructs a FileNotFoundException with the specified detail message. The string s can be retrieved later by the Throwable.getMessage() method of class java.lang.Throwable. It is in the same directory as my class files. I can get the code to run if I use the entire (absolute)path name with double backslaches.

wllwnn 21-09-2009 03:46 PM

Re: Java:FileNotFoundException
 
Another cause for this message, as I discovered on a Windows box, is that when you Install Continuum as a service it sucks in information about the JDK it is using and encapsulates it as one of the parameters in the service launch. This should output the system-dependent, unique path to where the virtual machine believes the file is, so you can see where the discrepancy is. If you subsequently substitute a newer (or older) JDK the service will no longer start.


All times are GMT +5.5. The time now is 11:54 PM.