Setting the path variable for Java
I had installed
Java
on a Windows 10 system as part of the installation of the
Eclipse
integrated development environment (IDE), which did not add the
directory where the java.exe and javac.exe executable files were installed.
I could temporarily add the directory where Eclipse installed those files
to the path
environment variable—see
Running java from an Eclipse installation from the command line—but
I didn't want to continue to have to do that every time I wanted to compile
a Java program at a command prompt or run one from
a
command-line
interface (CLI). So I added the path to the executable files to the
system-wide path environment variable so it would be permanent and apply
to all accounts on the system.
[ More Info ]
[/languages/java]
permanent link
Setting JAVA_HOME for Gradle
While trying to set up
Gradle, a software develpment build automation tool, on a Microsoft Windows
10 system, when I ran the gradle.bat file in the gradle bin directory, I saw
the message below:
C:\Users\Jim\Downloads\gradle-7.5.1-bin\gradle-7.5.1\bin>gradle.bat
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
C:\Users\Jim\Downloads\gradle-7.5.1-bin\gradle-7.5.1\bin>
I had installed Java with the
Eclipse
integrated development environment (IDE) previously and the java.exe
executable was installed beneath the
C:\Users\Jim\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_18.0.1.v20220515-1614\jre\
directory, so I created a JAVA_HOME
environment
variable pointing to that directory that applied to all accounts on the
system. You can create a temporary JAVA_HOME environment variable for the
account under which you are currently logged in from a
command line
interface (CLI) as noted at
Running java from an Eclipse
installation from the command line, but I wanted to create a permanent
environment variable so I typed advanced system settings
in
the Windows "Type here to search" field and then clicked on View
advanced system settings when I saw that listed.
[ More Info ]
[/languages/java]
permanent link