Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error while creating a new file

 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all....
this is for the first time that i m doing files topic.....the following code compiled fine but its giving an exception while running it...please help...
[edit]Add code tags. CR[/edit]
[ September 08, 2008: Message edited by: Campbell Ritchie ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error message you see?

(NB: This is a useful read to help you get the most out of these forums)
[ September 08, 2008: Message edited by: Paul Sturrock ]
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you past another File as first parameter to the File's constructor, it expect it to be a directory. Check the javadoc on the description of the constructor.
 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error is
Exception in Thread main.java.io.IOException:the system cannot find the path specified..
 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Thanks Wirianto i got the solution to it...i was passing a file instead...thanks!!
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please find the code button and ctrl-c ctrl-v when posting code, so we don't think you have an empty "catch" anywhere. I have added code tags so you can see how much easier your post is to read.

But well done sorting it out
 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanks Campbell !!!
being new to javaranch i was not aware of this..but i will take care of this in future for sure!!
 
Campbell Ritchie
Sheriff
Posts: 48921
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by geet kaur:
hey thanks Campbell !!! . . .


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic