Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-25-2008, 09:13 AM
Member
 
Join Date: Jul 2008
Posts: 5
adarsh_2484 is on a distinguished road
Please any one help me
I am new to Java.I have a text file in the server and I have to download it to the client.I have written the code.But it is not working.Please help me to correct it. Herewith I am attaching my code along with the message.Please go through it and rectify it.

With Regards,
Adarsh U
Attached Files
File Type: txt DownServlet.txt (2.9 KB, 6 views)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-25-2008, 10:20 AM
Member
 
Join Date: Jul 2008
Posts: 2
Jeyanthi priya is on a distinguished road
Hai everyone....
How can we write the code for file selection in core java. The file dialog should contain text documents only.....Please reply as early as possible
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-25-2008, 10:50 AM
Member
 
Join Date: Jun 2008
Posts: 22
itmani2020 is on a distinguished road
I think this may help u.....

-----------------
String wd = System.getProperty("user.dir");
JFileChooser fc = new JFileChooser(wd);
int rc = fc.showDialog(null, "Select Data File");
if (rc == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
filename = file.getAbsolutePath();
// call your function here
}
else
System.out.println("File chooser cancel button clicked");
return;
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-25-2008, 10:58 AM
Member
 
Join Date: Jul 2008
Posts: 2
Jeyanthi priya is on a distinguished road
but for the user.dir what should i give mani? and in show dialog also hae some null for that?
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-25-2008, 12:13 PM
Niveditha's Avatar
Senior Member
 
Join Date: May 2008
Posts: 299
Niveditha is on a distinguished road
Send a message via Skype™ to Niveditha
Hello Priya,
I think u dont know anything about JFileChooser, check this link for more details it will give you what you are looking for also
Working with File Filters : JFileChooser*«*Swing*«*Java Tutorial

And one request please dont put your queries in other's post create a new thread for yourself and specify the queries as your queries may go unseen like this.
__________________
To finish sooner, take your own time....
Nivedithaaaa
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-25-2008, 12:37 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,545
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by adarsh_2484 View Post
I am new to Java.I have a text file in the server and I have to download it to the client.I have written the code.But it is not working.Please help me to correct it. Herewith I am attaching my code along with the message.Please go through it and rectify it.

With Regards,
Adarsh U
What happened when you run the application. Any exceptions?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-25-2008, 05:51 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
Is this the same question as Can any one help me?
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 07-26-2008, 06:27 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,545
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Yes, I guess so. Here need some feedback from our thread starter about this. Since to me both questions are same I have to merge those two together.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 02:08 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org