Test whether Java is installed and configured successfully
Check the java version and enter the command:
[[email protected] ~]# java -Version
Create a Java mini -program test, named helloworld.java, enter the following command:
[[email protected] ~]# Touch HelloWorld.java
Copy the following code to HelloWorld.java:
Public class HelloWorld {Public Static Void Main (String [] ARGS) {System.out.println ("Hello, World! This is a test code by nixrft!");}}
After copying it, save the closure file. Compile and run this applet, enter the following command:
[[email protected] ~]# javac HelloWorld.java [[email protected] ~]# java HelloWorld
Will get the following display:
Hello, World! This is a test code by nixcraft!
How to (how) Run .jar and such Java applications?
The grammar is as follows:
[[email protected] ~]# java -jar file.jar [[email protected] ~]# java -jar /path/to/my/java/app.jar#/Path/my/java/app .jar represents the path of application [[email protected] ~] # java -jar /path/to/my/java/app.jar arg2 # arg1 represents parameter 1, arg2 represent parameter 2 indicating parameter 2