• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.io.Exception

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am sorry but i dont have any file like that
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
im sorry, tat was bcoz of a silly mistake in my classpath settings.. i rectified it. thanks anyways..
reply
    Bookmark Topic Watch Topic
  • New Topic