Step 1)
Create a folder / directory with any name.
This folder becomes a “default package “for java class files.
This folder becomes a “default package “for java class files.
Step 2)
Open any test editor (given by os) and develop the java application. Save it with any file name, but extension should be “.java” this is known as “compilation unit. The source code of java application is nothing but compilation unit.
Compilation unit has to be placed in the folder created in step 1.
Compilation unit has to be placed in the folder created in step 1.
Step 3)
Compile the source code/compilation unit by given the fallowing command at the dos prompt.
Command: Javac filename
Ex: javac hello.java
Note: javac command id given to the os. It invokes java compiler software .to the java compiler, compilation unit is given as input.
“Java file” -> “java compiler” -> “.Class files” (one or more file)
If the source code has no syntactical errors java compiler produces noe or more class files.
The no. of class files generated depends in the compilation unit. Each java class of the java application is compiled to one “.class” file.
Command: Javac filename
Ex: javac hello.java
Note: javac command id given to the os. It invokes java compiler software .to the java compiler, compilation unit is given as input.
“Java file” -> “java compiler” -> “.Class files” (one or more file)
If the source code has no syntactical errors java compiler produces noe or more class files.
The no. of class files generated depends in the compilation unit. Each java class of the java application is compiled to one “.class” file.
Step 4)
To execute the java program, given the fallowing command at the dos prompt
Command: Java intialclassname.
Command: Java intialclassname.
Comments
Post a Comment