InterviewSolution
| 1. |
Java Commands |
|
Answer» Following are the most widely used java commands:- 1. java –version: This is one of the most fundamental Java commands for checking the Java version installed on your machine. This is also used to confirm that the installation and PATH variable settings are correct. The above image is a snapshot of the output we get on running the java -version command. 2. javac –version: This command displays the version of the compiler that is in charge of compiling the source code. This is also a component of the Java Development Kit, or JDK for short. The above image is a snapshot of the output we get on running the javac -version command. 3. whereis: This Java command searches the directory for a given component. In the example below, we’ve taken into account javac. The above image is a snapshot of the output we get on running the command whereis javac. 4. echo: The echo command is a must-know command in Java since it allows you to display the contents of a specific file. In most cases, this is used to verify the PATH variables. The above image is a snapshot of the output we get on running the command echo %PATH% 5. javap: The javap command is used to disassemble one or more class files. The outcome is determined by the choices made. When no options are specified, the javap command prints both protected and public fields, as well as all of the methods of the classes supplied to it. 6. javah: Using this tool, you can produce c header and source files from a java class automatically. The generated c headers and source files are used to implement native methods and to refer to an object’s instance variable in the native source code. 7. Javadoc: The Javadoc command and its arguments are used to generate HTML pages or API documentation from a group of Java source files in a seamless manner. This tool parses the declarations and documentation comments in an array of java source files and generates HTML pages that describe the public and protected classes, interfaces, fields, and nested classes, according to the default parameters. |
|