File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes error while creating a new file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error while creating a new file" Watch "error while creating a new file" New topic
Author

error while creating a new file

geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
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

Joined: Apr 14, 2004
Posts: 10336

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 ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 210

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

Joined: Sep 03, 2008
Posts: 78
the error is
Exception in Thread main.java.io.IOException:the system cannot find the path specified..
geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
hey Thanks Wirianto i got the solution to it...i was passing a file instead...thanks!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
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

Joined: Sep 03, 2008
Posts: 78
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

Joined: Oct 13, 2005
Posts: 39478
    
  28
Originally posted by geet kaur:
hey thanks Campbell !!! . . .


 
Don't get me started about those stupid light bulbs.
 
subject: error while creating a new file