You are not logged in.

#1 2014-06-23 21:32:08

TheGuyWithTheFace
Member
Registered: 2012-12-09
Posts: 113

[Solved] How to specify which version of Java to use?

I have OpenJDK 7 as my default, but I also am trying to use Oracle's Java 7 for a specific program. I have installed jdk7-compat as suggested by the arch wiki, but I am unsure how to use it specifically.   
   
java -version outputs:

OpenJDK Runtime Environment (IcedTea 2.5.0) (Arch Linux build 7.u60_2.5.0-2-x86_64)
OpenJDK 64-Bit Server VM (build 24.60-b09, mixed mode)

so OpenJDK is  still the default, which is good. At the same time, how do I use Oracle's Java for a specific program?

Last edited by TheGuyWithTheFace (2014-07-01 16:50:01)

Offline

#2 2014-07-01 08:28:40

mgmartins
Member
From: Spain
Registered: 2009-06-18
Posts: 26

Re: [Solved] How to specify which version of Java to use?

You have to create a bash script to execute that program, where you define your Java variables. For example, let's supposed your oracle Java is installed at /opt/java_1.6.14/ folder

#!/bin/bash
export JAVA_HOME=/opt/java_1.6.14/
export PATH=/opt/java_1.6.14/bin:$PATH
<your command>

Last edited by mgmartins (2014-07-01 08:29:27)


Spanish Arch Linux user since 2009

Offline

#3 2014-07-01 16:50:11

TheGuyWithTheFace
Member
Registered: 2012-12-09
Posts: 113

Re: [Solved] How to specify which version of Java to use?

That works - thanks!

Offline

#4 2014-08-07 21:20:27

Wikimig
Developer
From: France
Registered: 2004-12-10
Posts: 77
Website

Re: [Solved] How to specify which version of Java to use?

@TheGuyWithTheFace: FYI I've just pushed a set of OpenJDK7 packages to [testing] that does not declare conflict on java-{environment,runtime}. OpenJDK8 will then follow. You might want to try these.

More info: https://wiki.archlinux.org/index.php/Ja … vironments

Offline

Board footer

Powered by FluxBB