7 How ".class" File is loading by Java Development Tool and other Tools.

Development Tool:  1)java
                                  2)javac
                                  3)javap
                                  4)javaw
                                  5)javaws
                                  6)javarmi
                                  7)javadoc


1)java: 

Code: Save the file with Loading.java . After that compile the file using javac Loading.java .
After that you will get Loading.class file then to execute it type java Loding . Then Java will communicating with JVM and JVM will communicating Loading.class file communicating means bring the file from secondary memory to primary memory.

public class Loading{
static{
      System.out.println("Static Block");
}

public static void main(String...r)throws Exception{
System.out.println("Main Method");
}
}


Output:


Java is Internally communicating with lots of .class file is loading by compiler. We can Check them using  java -verbose Loading.java  





2)javap

javap also loading  ".class" file then what happen javap will read .class file and finally it will converting into what the .class file contain byte code and it will converted into source code.



3)javaw:

We can execute the program with the help of javaw also


Code:

import java.io.*;
public class Loading{
static{
      System.out.println("Static Block");
}

public static void main(String...r)throws Exception{
System.out.println("Main Method");
FileOutputStream fos = new FileOutputStream("yes.txt");
PrintStream ps = new PrintStream(fos);
ps.println("Yes we can execute");
}
}

Note: Compiling using javac Loading.java after that  I don't have any yes.txt in my folder.


After Executing: I am not getting any output on the console.



Let me check On the folder I have yes.txt


So by using this javac javap javaw we can execute the program

Previous
Next Post »