Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5960385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:49:11+00:00 2026-05-22T18:49:11+00:00

This is what I am trying to do: I have written a Java program

  • 0

This is what I am trying to do:

I have written a Java program which requires two file paths as input parameters. The code is working fine and accurate. The problem here is that every time I need to give the complete file path in command prompt. So what I thought is to link this with a HTML page which will give you two browse button in order to browse file.

Now my problem is how to give the two browsed file path in a Java method. I had written entire Java code in batch file as of now. I tried using <input type=file> in HTML, but how to pass this value in Java that I am unaware of?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:49:11+00:00Added an answer on May 22, 2026 at 6:49 pm

    If this application is to be used on the desktop you don’t need servlets or HTML, simply pop up two JFileChoosers and select the files using these.

    The code to do this is:

    
    import java.io.File;
    
    import javax.swing.JFileChooser;
    
    public class Main {
        public static void main(String[] args) {
            JFileChooser fc = new JFileChooser();
            fc.showOpenDialog(null);
            File f1 = fc.getSelectedFile();
            fc.showOpenDialog(null);
            File f2 = fc.getSelectedFile();
            System.out.println(f1.getName());
            System.out.println(f2.getName());
            /* make sure to make some checks to the files f1, f2 */
        }
    }
    

    Have fun! 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this php code, with which I am trying to generate a popup
I have this piece of code I'm trying to get to display but no
I'm trying to have my Struts2 app redirect to a generated URL. In this
I have been trying to get around this error for a day now and
I have been trying to tackle this problem , but I am having difficulty
This may be a bit of a nooby question, I have been trying to
I have looked around on the Internet trying to answer this question. It seems
I'm trying to upgrade my subversion server (I have it hosted with Dreamhost) This
I have had to do this several times, usually when trying to find in
I am trying to learn ASP.NET MVC and I hit this problem: I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.