======================== Reprint ===========================
Setting environment variables
[[email protected] opt]# vi/etc/profile; Edit the system configuration file
Then enter I and add the following content
==================================================================================
Export Java_home=/usr/java/jdk1.7.0_04
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin
Finally press the EXC key, enter the colon, and enter: Wq Save exit
Test
VI Hello.java
Then enter I and add the following content
Class Hello
{
public static void Main (string[] args)
{
System.out.println ("Hello world!");
}
}
Finally, press ESC, enter a colon, and last enter: Wq save exit
Javac Hello.java
Java Hello
If a "Java lang Unsupportedclassversionerror" error occurs
is a version issue:
To change the compile and execute command to:
/usr/java/jdk1.7.0_04/bin/javac Hello.java
/usr/java/jdk1.7.0_04/bin/java Hello
Linux JDK environment variable configuration and testing