Results 1 to 8 of 8
  1. #1
    adarsh_2484 is offline Member
    Join Date
    Jul 2008
    Posts
    5
    Rep Power
    0

    Question 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 Attached Files

  2. #2
    Join Date
    Jul 2008
    Posts
    2
    Rep Power
    0

    Default

    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

  3. #3
    itmani2020 is offline Member
    Join Date
    Jun 2008
    Posts
    23
    Rep Power
    0

    Default

    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;

  4. #4
    Join Date
    Jul 2008
    Posts
    2
    Rep Power
    0

    Default

    but for the user.dir what should i give mani? and in show dialog also hae some null for that?

  5. #5
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    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

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Is this the same question as Can any one help me?

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •