Core Java Tutorials - Program Execution in Java, How to Compile a Java Program and How to Run A Java Program
javac Welcome.java
If there are no syntax errors, the compiler generates a byte code file with a .class extension. So the preceding command generates a file named
Welcome. class
To execute a Java program is to run the program’s byte code. You can execute the byte code on any platform with a JVM. Java byte code is interpreted. Interpreting translates the individual steps in the byte code into the target machine-language code one at a time rather than translating
the whole program as a single unit. Each step is executed immediately after it is translated. The following command runs the byte code:
java Welcome
A Java compiler translates a Java source file into a Java bytecode file. The following command compiles Welcome.java:
If there are no syntax errors, the compiler generates a byte code file with a .class extension. So the preceding command generates a file named
Welcome. class
The Java language is a high-level language while Java bytecode is a low-level language. The bytecode is similar to machine instructions but is architecture neutral and can run on any platform that has a Java Virtual Machine (JVM) Rather than a physical machine, the virtual machine is a program that interprets Java bytecode. This is one of Java’s primary advantages Java bytecode can run on a variety of hardware platforms and operating systems.
the whole program as a single unit. Each step is executed immediately after it is translated. The following command runs the byte code:
java Welcome
{ 0 comments... read them below or add one }
Post a Comment