• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.io.Exception

 
Marino Christe
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey can anybody plz tel me y this is happening..
wen i compiled
try{
}catch(java.io.IOException e){}

it gives cannot find symbol 'io'.

but if i add the statement
import java.io.*
and say catch(IOException e){}

it saying IOException not thrown in try block.
y is dis?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the file that you have creatively named java.java and its class java.class from the directory that is in your classpath
 
Marino Christe
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am sorry but i dont have any file like that
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm... thats just very wierd then. I though you would have a java file named "java". Do this... compile using this command

javac -verbose your_class_name.java

Do you see something like this at the end of the dump ?

[checking test]
[loading C:\PROGRA~1\Java\JDK15~1.0_0\jre\lib\rt.jar(java/io/IOException.class)]

[loading C:\PROGRA~1\Java\JDK15~1.0_0\jre\lib\rt.jar(java/lang/Exception.class)]

[loading C:\PROGRA~1\Java\JDK15~1.0_0\jre\lib\rt.jar(java/lang/Throwable.class)]

[loading C:\PROGRA~1\Java\JDK15~1.0_0\jre\lib\rt.jar(java/lang/Error.class)]
[loading C:\PROGRA~1\Java\JDK15~1.0_0\jre\lib\rt.jar(java/lang/RuntimeException.
class)]
test.java:9: exception java.io.IOException is never thrown in body of correspond
ing try statement
catch(java.io.IOException e)
^
[total 2953ms]
1 error

-----------------------------------------------------------------------


This class was loaded - java/io/IOException.class

Please post your dump here. I think in your case the classes like System and PrintStream will be loaded after the error occurs.
 
Marino Christe
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im sorry, tat was bcoz of a silly mistake in my classpath settings.. i rectified it. thanks anyways..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic