This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file saving

 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
I need to save a zip file to a specified folder using the FileDialog window...actually in my applet application i downloaded a number of files and zipped them all in a single zip file in my temp folder...but i want this zip file to be saved in any other folder instead of saving it to temp folder, by showing the save dialogue window...from which the user can choose a desired folder to save this file.... can i use FileDialog() for this??
please do help me...
 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I personally would have preferred using a JFileChooser which can be configured to select files or directories.

And here is a good example of JFileChooser, if you need.

http://www.onlinexamples.com/showfullexample.action?idexamples=81&title=Display%20Image%20In%20Jlabel%20Within%20A%20Jpanel
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply....
But here this is not actually working for me...
 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless signed, an Applet can't interact with the local filesystem.
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Unless signed, an Applet can't interact with the local filesystem.

I'm using signed applet ...but still not getting the result....can i save a file before writing contents into it?
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to tell us what *is* happening, and what you were expecting to happen instead. Seeing the related code would also help.
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my code to zip the files...
the name comes from a list...there is now two files in the name filed, and it can be more than two...here i want to save the zipFile to any folder using the JFileChooser instead of saving it to the temp folder..in my code i saved it in the temp folder..
Here the zipping action works fine and the file is saved with the name zipdemo.zip in the temp folder...

 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not following - if you don't want to save the file in the temp directory, why are you doing so? You've already been pointed to an example of using a JFileChooser to select a different directory; what stops you from doing that?
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim Moores....
I was trying it through the wrong path
thanks again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic