简体   繁体   中英

How can I change java version on local linux server

I built my NetBeans web project with Java 1.5 successfully, however; my linux server supports / uses Java 1.4 and Java 1.5 (as well as JBoss 4.0.2).

When I check the version of my project ( java -version ) it says that the current version is Java 1.4.2. However, I don't want to change the "JAVA_HOME" setting on the server because other projects need to use this version.

I want my project to use Java 1.5 from the server... An idea as to how I should go about doing this? Is there a configuration that I can change?

I have this error:

java.lang.UnsoupportedClassVersionError: bad Version in .class file

You need Java 1.5 version installed in your Linux server.

Next, run the following set of commands in your terminal/command prompt:

  • JAVA_HOME="{fix-me}"
  • export JAVA_HOME
  • export PATH = $JAVA_HOME/bin:$PATH

In the place holder {fix-me} specify the path of Java 5 that is installed in the Linux machine.

This would only temporarily set the Java version to 5 until the terminal/command prompt session is alive. So you need not worry about disturbing other projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM