File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes problem in creating a new file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem in creating a new file" Watch "problem in creating a new file" New topic

problem in creating a new file

rahul karwal
Ranch Hand

Joined: Oct 26, 2001
Posts: 73
hi ppl,
i am trying to create a file given the name of the file at command line but when i try to compile its giving me an error saying createNewfile() method not found in class i dont know why please help me......
thank u
public class createfile{
public static void main(String[]args){
String name = args[0];
File file = new File(name);
boolean cheak = file.exists();
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Apparently, your JDK must not be 1.2 or above. Method createNewFile() is only available since java 2 (JDK 1.2 or higher)

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: problem in creating a new file
It's not a secret anymore!