aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes java.io.Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "java.io.Exception" Watch "java.io.Exception" New topic
Author

java.io.Exception

Marino Christe
Greenhorn

Joined: Apr 15, 2006
Posts: 17
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

Joined: Feb 24, 2006
Posts: 6662
    
    5

Remove the file that you have creatively named java.java and its class java.class from the directory that is in your classpath


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Marino Christe
Greenhorn

Joined: Apr 15, 2006
Posts: 17
i am sorry but i dont have any file like that
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

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

Joined: Apr 15, 2006
Posts: 17
im sorry, tat was bcoz of a silly mistake in my classpath settings.. i rectified it. thanks anyways..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.io.Exception