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
Last Wiki Answer Submitted: August 6, 2012 10:40 am by Compile30 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
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 !
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.
Download and play around with Eclipse. That’ll help you tremendously.
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 !
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
FOR COMPILING
javac program_name.java
FOR EXECUTING
java program_name
#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