java vs. javaw
When a Java application is launched with java
command, JVM uses the command window as a console.
If you don't want this console window, you can use javaw
command to launch the application. The difference between java
and javaw
is javaw
does not create any console whereas java
does.
Here is what I did to test the javaw
tool.
1. Write and compile Test.java
2. Open a command window to run Test.class
using java Test
.
3. Look at the output shown in the window, which is not showing any more
. Because the window is being used as console for java
tool.
4. Now, run the program using javaw Test
.
5. Look at the output again, the command prompt is asking to provide any new commands.
6. To understand what happens to this program? Check the process list for both java
and javaw
. In both case they are listed in process list.
Hope, you understand that javaw
is used to launch an application where console window is not needed. So javaw
is good tool for the applications like GUI applications and server applications.
In both case file redirexction is supported. Let us test it.
Create a file containing a integer number
Now you can understand that I/O can be associated with both.
As javaw.exe
does not need command line window to appear. If error occurs at the time of execution, the error is shown in a dialog box.
java.exe
can be used when input and output texts are read from or shown on console.
As IDEs (like Netbeans, Eclipse etc.) are using their internal console instead of system console they are using javaw instead of java.
javap
The javap command is used to disassemble one or more class files and prints the output to stdout. You can use different options according to your requirements. If you receive a class file, you can check name of the package, methods, variables etc. as shown below.
The output of
javap
command without any option.
The output of
javap
command with
-c
option.
jconsole
jconsole
is monitoring and management tool for local and remote processes.
Select a process from the list and connect. You will see the following screen.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.