What is the command to compile a Java program?

5 pts.
Tags:
Java
Java programming
What is the command to compile a Java program? What is the command to run a Java application?

Answer Wiki

Thanks. We'll let you know when a new response is added.

compile:

javac YourProgram.java

run:

java YourProgram

Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program

——First set the path of the java at the command prompt.

>set path=”you directory path containing java(bin folder)”

after that use javac. This command is use to compile the java program.

>javac program.java

to run your java program use java.

> java program

Answer by Ashish2:

You can also place the compiled java class file in a specified directory by

javac -d

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Kevin Beaver
    Download and play around with Eclipse. That'll help you tremendously.
    17,800 pointsBadges:
    report
  • Subhendu Sen
    You may create a launcher (if u run in linux) and from that u may run java program. The advantage is that, every time u won't write the command rather u put only the java file name !
    29,780 pointsBadges:
    report
  • TomLiotta
    What is the command to compile a Java program? What is the command to run a Java application? On what platform? On System i, you would use javac and java commands just as you would anywhere else for common java processing. But you could also use the CRTJVAPGM command if you wanted to run your java program directly from a CL program with the RUNJVA command. Tom
    125,585 pointsBadges:
    report
  • shiva3322
    FOR COMPILING javac program_name.java FOR EXECUTING java program_name
    660 pointsBadges:
    report
  • Juna
    [...] What is the command to compile a Java program? [...]
    0 pointsBadges:
    report
  • mikejava
    #1 You should download the JDK and install you local machine, set the JAVA_HOME and some other variables. Then javac test.java java test
    35 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following