cannot write to file (in interpreted Java)

For some reason, I can create a file but cannot write to it using FileWriter, when coding in interpreted Java. I do the following:

file = new FileWriter( "file.txt" );

file.write( "just some text" );

file.close();

This creates file.txt but does not write the text to it. However, when I code the following in normal Java, it works just fine, meaning it creates and writes to file.txt:

import java.io.FileWriter;

public class Test {
public static void main( String[] args ){
try {
FileWriter file = new FileWriter( "file.txt" );

file.write( "Just some text" );

file.close();
}
catch ( Exception e ) {
System.out.println(
"Test.java: the following error occurred: " +
e.getMessage() );
}
}

}

I checked the file's and it's directory's permissions and they both have write permissions. Also both files from both programs above were writen to the same location so file permissions should not be an issue. So what's the problem? :(

cannot write to file (in interpreted Java)

speedster,

It might smell like Java and even taste a might like it but if you sniff it real slow you'll notice a hint of BeanShell. The added layer of BeanShell requires that you do somethings a leetle bit differently than if you were tromping the Ujung Kulon National Park.

For more on BeanShell, starting with difference in Class management please visit...

http://www.beanshell.org/manual/classpath.html#Class_Loading_and_Class_Path_Management

Still tastes good, no?

-Scott