• Post Reply Bookmark Topic Watch Topic
  • New Topic

writing from a jar

 
Felipe Walker
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a class that writes a simple text file.
I packaged it in a signed applet and now it will not write the file.

public void writeFile(String text,String name) {
try{
File outputFile = new File(name);
FileWriter out = new FileWriter(outputFile);
out.write(text);
out.close();
}
catch(IOException e){
System.out.println("ReadWriteUtility write error: " + e);
}
}
Worked fine before but not when I put it in a signed jar.
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you get an exception?
 
Felipe Walker
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no exceptions
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there's no exceptions, then the write worked. Maybe it's not ending up in the directory you think, who knows what the "current working directory" for an applet is, but the file is being written. You can find the path of a file with File.getAbsolutePath(). Try printing it out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!