[prev in list] [next in list] [prev in thread] [next in thread] 

List:       debian-user
Subject:    Re: no JAVA_HOME in the path
From:       Roland_Müller <roland.em0001 () googlemail ! com>
Date:       2022-09-27 18:32:56
Message-ID: aff9bab3-352a-90d5-1453-e5f95ec06994 () googlemail ! com
[Download RAW message or body]

Hello,

here is some clarification of the relationship between JAVA_HOME and the 
PATH.

JAVA_HOME points to the base directory of a Java JRE or JDK 
(=development) directory. Under $JAVA_HOME one should find a bin 
directory which contains java, javac and other binaries.

In the case you just need the wanted java or javac in the execution path 
actually JAVA_HOME is not needed. Simple hello-world like compilations 
from command line work ok when java(c) is in path.

Java based tools make typically use of JAVA_HOME and some of them refuse 
to start unless JAVA_HOME is set to a valid location. E.g. Maven even 
prefers JAVA_HOME over the version of javac that is in the execution path:

$ $ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk

$ mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 
2019-04-04T22:00:29+03:00)
Maven home: /opt/maven/apache-maven-3.6.1
Java version: 11.0.16.1, vendor: Red Hat, Inc., runtime: 
/usr/lib/jvm/java-11-openjdk-11.0.16.1.1-1.fc36.x86_64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.19.10-200.fc36.x86_64", arch: "amd64", 
family: "unix"

but

$ java -version
openjdk version "17.0.4.1" 2022-08-12
OpenJDK Runtime Environment (Red_Hat-17.0.4.1.1-1.fc36) (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.1.1-1.fc36) (build 17.0.4.1+1, 
mixed mode, sharing)


BR,

Roland


On 8/27/22 05:06, Amn wrote:
> Thanks!
> The problem is solved.
>
> On 2022-08-23 9:40 a.m., Roberto C. Sánchez wrote:
>> On Tue, Aug 23, 2022 at 09:21:38AM -0400, Amn wrote:
>>>     When I type echo $JAVA_HOME, Debian 11's Konsole displays ... 
>>> nothing,
>>>     'echo $PATH' reports -
>>> /usr/local/[1]bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:libtool:
>>>     /usr/bin/libtool /usr/share/libtool 
>>> /usr/share/man/man1/libtool.1.gz -
>>>     However if I type, 'java --version' I get -
>>> /usr/local/[2]bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:libtool:
>>>     /usr/bin/libtool /usr/share/libtool 
>>> /usr/share/man/man1/libtool.1.gz -,
>>>     which is correct.
>>>     Where is $JAVA_HOME set or how do I add it to the path permanently?
>>>
>> You have to set it yourself.
>>
>> Options include /etc/bashrc, /etc/profile, /etc/profile.d,
>> /etc/environment, /etc/environment.d, and possibly others, for setting
>> it system-wide, and their per-user counterparts in $HOME for setting it
>> on a per-user basis.
>>
>> Regards,
>>
>> -Roberto
>>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic