Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux System Getting Started Tutorial: How to change the default Java version in Linux     - How to monitor Linux system performance Nmon (Linux)

- PCM audio under Linux (Linux)

- Linux system security check notes on performance (Linux)

- C ++ complex class of operator overloading (Programming)

- Linux and Windows Security Topics (Linux)

- Security basics: simple analytical framework for Linux system firewall (Linux)

- Java polymorphism and exception handling (Programming)

- How to manage your to-do list with the Go For It on Ubuntu (Linux)

- Using DOS command to change UNIX administrator password (Linux)

- How to update the ISPConfig 3 SSL Certificates (Server)

- Circular list of Java programming (Programming)

- To compile and install MySQL 5.7.7 RC under CentOS 7.1 (Database)

- Ubuntu 14.04 LTS 64-bit install GNS3 1.3.7 (Linux)

- Summarize small problems encountered in the use Lua (Programming)

- Oracle 11g on Linux system boot from the startup settings (Database)

- Linux script commands - terminal recorder (Linux)

- Apache Mina framework Practice (Programming)

- Using DBMS_STAT function closes mission (Database)

- Ubuntu prevent arp attacks (Linux)

- Oracle 12C RAC optimizer_adaptive_features cause of data into overtime (Database)

 
         
  Linux System Getting Started Tutorial: How to change the default Java version in Linux
     
  Add Date : 2018-11-21      
         
         
         
  Question: When I try to run a Java program in Linux, I encountered an error. It looks like the program was compiled with a different version of Java with my local. How do I switch the default version of Java on Linux?

When the Java program is compiled, the compiler environment will set a "target" variable to set the minimum Java program can run version. If the program runs on a Linux system, you can not meet the minimum JRE version requirements, you will encounter the following error at run time.

Exceptionin thread "main" java.lang.UnsupportedClassVersionError: com / xmodulo / hmon / gui / NetConf: Unsupported major.minor version 51.0
For example, a program in Java JRE 1.7 compiler, but the system only Java JRE 1.6.

To solve this problem, you need to change the default version of Java to Java JRE 1.7 or higher (assuming JRE already installed).

First, try the following update-alternatives command to check your Java version available on your system:

$ Sudo update-alternatives --display java

In this example, it installed a total of four different versions of Java: OpenJDK JRE 1.6, Oracle Java JRE 1.6, OpenJDK JRE 1.7 and Oracle Java JRE 1.7. Now that the default Java version is OpenJDK JRE 1.6.

If you do not need Java JRE, you can refer to these instructions to complete the installation.

Release candidate now available, you can use the following commands to switch between the available Java JRE default Java version:

$ Sudo update-alternatives --config java
When prompted, choose what you want to try the Java version. In this example, we chose Oracle Java JRE 1.7.


Now use the following command to verify the default Java version.

$ Java -version

Finally, if you define the JAVA_HOME environment variable, update the variable settings according to your version of Java.
     
         
         
         
  More:      
 
- Android memory optimization of the optimal load Bitmap (Linux)
- Oracle Database Delete Delete million or more common method of heap table data (Database)
- The Linux kernel and AVL tree in red-black tree (Programming)
- CentOS 6 / Linux su: Unable to set user ID: Resource temporarily unavailable (Linux)
- Python in os.path Magical (Programming)
- Nagios plugin installation tutorial of Nrpe (Linux)
- Ubuntu uses under KVM + Qemu virtual machine build (Linux)
- GDB remote connections RX Probe online debug program (Programming)
- Raspberry Pi configuration wireless hotspot (Linux)
- Manually create Oracle Database Explanations (Database)
- Use Aptik Battery Monitor monitoring Ubuntu laptop battery usage (Linux)
- Iptables small summary (Linux)
- Linux Command Study Notes (Linux)
- Linux system security reinforcement (Linux)
- Java coding conventions (Programming)
- Spring Data JPA call a stored procedure examples (Programming)
- How to install Wine 1.7.20 under Ubuntu or Linux Mint (Linux)
- How to create a new file system / partitions under Linux terminal (Linux)
- Logging information through the web GUI (LogAnalyzer) (Server)
- Analysis of Java exception (Programming)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.