tags:

views:

65

answers:

2

I have a problem with my Java program. I want to delete a file on my hdd; I use a MacBook. Here is my code:

public static void main(String[] args) 
{
    File actualFile = new File("/Users/luffy/test.xml");
    actualFile.delete();
}

chmod is set! Help please.

A: 

Make sure that the file is not in use by another program.

Make sure that you have closed all streams accessing this file.

willcodejavaforfood
On a mac/UNIX the file used by another program won't cause any problem. Same thing for the streams.
Colin Hebert
A: 

I dont have open a stream... and no programm using the file... Exceptionis:

Exception in thread "main" java.lang.NoClassDefFoundError: javaapplication1/Main
Caused by: java.lang.ClassNotFoundException: javaapplication1.Main
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Java Result: 1
Christian Soth
Ahh damnt my class reference to the packge was wrong :@
Christian Soth