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

  • SEARCH
  • Home
  • 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 5942555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:16:12+00:00 2026-05-22T16:16:12+00:00

It is a really simple thing but I cannot get my head around it.

  • 0

It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet.

My goal is to create a .bat which will open cmd and execute my Main.java into command prompt. Easy isn’t it, but I have got confused about how?

Below I am writing steps which my batch file should perform

  1. open cmd
  2. javac Main.java
  3. java Main

My file will reside next to all my .java so I am assuming I don’t need to give explicit path.

My understanding so far by research:

  1. open text editor
  2. write a code to open cmd(Which I am not sure how)
  3. echo javac Main.java (Which is still fuzzy concept for me)
  4. echo java Main

Save as: name.bat

Any help will be appreciated. Thank you.

  • 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-22T16:16:12+00:00Added an answer on May 22, 2026 at 4:16 pm
    1. open notepad

    2. write

      @echo off
      
      javac Main.java
      
      java Main
      

    3.saveAs blahblah.bat

    make sure that Main.java resides with your batch file and java path is set in env. variable

    4 . double click on batch file, no need to open cmd explicitly tt will open itself on .bat execution

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

Sidebar

Related Questions

Seems like as really simple thing to do, but I just can't track it
This should be a really really simple thing, but for some reason it is
I'm sure this is a really simple thing, but I haven't worked in C++
It's really simple, I just want one screen. Wow, that [shiny thing] must have
I have a problem which I guessed would be really simple to solve... but
A really simple shell script question. I have a file with something like this:
This is probably a really simple jQuery question, but I couldn't answer it after
I have searched and tried a number of things for this, but simply cannot
I think the solution is really simple, I just haven't come across it online.
Really simple question - how do I do a search to find all records

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.