adesh singh
adesh singh

Reputation: 1727

set class path in linux and run the jar file making executable

I am trying to run the jar file on linux created from windows using jdk7 . I am using the following command to run the

  java -jar jarfile.jar

its running the jar and throwing the exception as un recognised class format version. because linux is showing the java version as 1.4.2 while i have extracted the jdk1.7 in the root directory but it is still taking the java version as 1.4.2 . what i have to do to run the jar file created using jdk1.7 . I have extracted the java (jdk1.7) on linux in root directory.

Upvotes: 0

Views: 1710

Answers (2)

Jo Young
Jo Young

Reputation: 9

Make sure jdk1.7 in front of jdk1.4.2 in system variable PATH. Do you have installed oracle in your Linux OS? I have encountered the same question in windows OS because I have installed oracle. If some software just like oracle is installed, maybe it will insert jdk1.4 in front of all other software paths in system variable PATH.

Upvotes: 0

Brian Agnew
Brian Agnew

Reputation: 272337

You need to specify the JDK 1.7 on your path e.g.

$ PATH=/jdk17/bin:$PATH

Note how you specify not just the path to the 1.7 installation, but the bin path within that.

Typing

$ which java

after you've changed the PATH will confirm if this has worked.

Upvotes: 1

Related Questions