Multiple Java versions

Jason Helfman jgh at FreeBSD.org
Wed Sep 25 06:28:35 UTC 2013


On Tue, Sep 24, 2013 at 11:07 PM, Andrea Venturoli <ml at netfence.it> wrote:

> On 09/24/13 21:38, Jonathan Chen wrote:
>
>> On 24 September 2013 22:36, Andrea Venturoli <ml at netfence.it> wrote:
>> [...]
>>
>>> Now, according to JAVAVMS(5), "By default, javavm will select the most
>>> ``native'' and up to date version".
>>>
>>> However:
>>>
>>>  % java -version
>>>> openjdk version "1.6.0_32"
>>>> OpenJDK Runtime Environment (build 1.6.0_32-b27)
>>>> OpenJDK Server VM (build 20.0-b12, mixed mode)
>>>>
>>>
>>>
>>> Any way to fix this?
>>>
>>> AFAICT I didn't set any relevant environment variable, anything in
>>> /etc/make.conf or in javavms' own config files.
>>>
>>
>> JAVA_HOME is what you need:
>>
>> jonathan:~,7:36am> unsetenv JAVA_HOME
>> jonathan:~,7:36am> java -version
>> openjdk version "1.6.0_32"
>> OpenJDK Runtime Environment (build 1.6.0_32-b27)
>> OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
>> jonathan:~,7:36am> setenv JAVA_HOME /usr/local/openjdk7
>> jonathan:~,7:36am> java -version
>> openjdk version "1.7.0_25"
>> OpenJDK Runtime Environment (build 1.7.0_25-b15)
>> OpenJDK 64-Bit Server VM (build 23.21-b01, mixed mode)
>>
>>
> Ok, fine for me.
>
> I'd just point out: isn't it in contrast to what the man page says (i.e.
> "By default, javavm will select the most ``native'' and up to date
> version")?
>
> Should the docs be corrected then?
>
>  bye & Thanks
>         av.


The docs may need clarification, however you may want to look into using:

java/javavmwrapper

cc: java

-jgh

-- 
Jason Helfman          | FreeBSD Committer
jgh at FreeBSD.org     | http://people.freebsd.org/~jgh  | The Power to Serve


More information about the freebsd-ports mailing list