Java jre path windows

How To Set Java, JRE and JDK Home Path and Environment Variables On Windows?

Java is a very popular programming language which provides a different component in order to run, develop Java applications. JRE or Java Runtime Environment is used to run Java application. JDK or Java Development Kit is used to develop Java applications. In this tutorial, we will learn how to set up Java, JRE, and JDK operating system path variables in order to work properly.

Locate JRE or JDK Path

Before starting the configuration we have to locate the JRE or JDK path. JRE or JDK generally installed on the Program Files or Program Files(x86) directory under the Java directory like below.

Locate JRE or JDK Path

and under the Java directory the JDK is residing.

Locate JRE or JDK Path

Set Java HOME_PATH Environment Variable

Now we have learned the path of the Java, JRE or JDK installation. We can set this path as Java HOME_PATH environment variable. We will open the computer properties with by running sysdm.cpl in the Run menu like below. We can also open it from the File Explorer -> Computer -> Right Click.

Open System Properties

In the system properties, we will navigate to the Advanced tab which provides the Environment Variables button like below.

Open Environment Variables

Below we can see the environment variables menu where we will create the JAVA_HOME system variable and set the path accordingly. We click to the New in order to create a new system variable.

Create New System Variable

Here we will set the Variable Name as JAVA_HOME and the Variable Value the path or Java, JRE or JDK which is C:\Program Files\Java\jdk-12 in this example. Then we will click OK.

Set JAVA Executable Path

If we want to run java.exe or similar executables provided by JRE or JDK we have to add the path of Java in the Path variable like below. We select the system variable named Path and click to the Edit .

Here we click to New which will add a new line to the existing values.

Here we will set the bin folder path which is C:\Program Files\Java\jdk-12\bin in this example.

Add Path System Variable

Then we will click OK and OK in the environment variables screen which will save and activated new path configuration.

Check Java Is Working

We can check the new path configuration simply opening a new command line interface MS-DOS. Then just type java -version which will execute java.exe with the -version option. We can see the current java binary version by running it.

Читайте также:  Teac hr audio player для windows

3 thoughts on “How To Set Java, JRE and JDK Home Path and Environment Variables On Windows?”

What is the point in setting the JAVA_HOME to the path to the jdk install folder path if you then edit the Path variable and add the full path to the jdk bin folder? Shouldn’t you make use of the JAVA_HOME variable and add %JAVA_HOME%\bin to the Path instead.

@James Coffey, maybe the point of setting JAVA_HOME is just in preparation for GlassFish:
https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html
Still, the author could make use of it in Path as you say, but maybe the author is just trying to keep it simple.

THANK YOU SO MUCH. YOU SAVED MY LIFE. I need to use java in jupyter

Установка Java (JDK) в Windows и Linux, переменная PATH и JAVA_HOME

Java — язык общего назначения, основанных на классах, поддерживающий многопоточность и являющийся объектно-ориентированным. Программы на Java компилируются в так называемый byte-код, который в свою очередь запускается Виртуальной Машиной Java (Java Virtual Machine — JVM), независимо от архитектуры компьютера. На данный момент последняя версия Java двенадцатая.

Ниже мы рассмотрим — как установить Java на Windows и Linux. Для каждой из платформ создана своя версия JDK, JRE и JVM, хотя сами программы на Java и не меняются от платформы к платформе (что логично).

Давайте проясним несколько вещей перед тем, как мы начнем.

  • JDK (Java Development Kit) — эта штука нужна для разработчиков на Java (то есть нас) и включает в себя инструменты разработки, документирования, упаковки и так далее (в том числе компилятор Javac, Javadoc, Jar-упаковщик и дебаггер).
  • JRE (Java Runtime Environment) — сюда включены библиотеки Java, которые необходимы для запуска Java-программ. Эта штука нужна обычным пользователям и не содержит инструментов для разработки.
  • JVM (Java Virtual Machine) — это и есть сама виртуальная машина Java, которая непосредственно и запускает наши Java-программы (байткод). Ее реализация написана для множества железа и платформ.

Установка Java (JDK) в Windows

Первым делом необходимо скачать JDK с официальной страницы Oracle. В нашем случае нужна версия под Windows, в самом низу.

После установки запустите скачанный exe-файл и установите его на ваш компьютер. Как только вы это сделаете, нужно будет настроить окружение.

Перейдите в Панель управления -> Система и безопасность -> Система. На вкладке «Дополнительно» нажмите на «Переменные среды», как показано ниже:

Теперь нужно найти и дополнить переменную PATH так, чтобы она содержала путь до установленной Java. Выберите PATH и нажмите «Изменить»:

Вы увидите список уже установленных переменных. Сейчас необходимо нажать «Новый» и добавить путь, по которому установлена Java (каталог bin!). По умолчанию это обычно «C:\Program Files(x86)\Java\jdk\bin».

Нажмите «Готово» (или «Ок»), сохраните настройки и на этом всё готово! Чтобы проверить, что установка прошла корректно, откройте консоль и введите:

Если вы получили сведения о версии Java, значит всё хорошо.

Установка Java (JDK) на Linux

В Linux есть несколько способов установить Java. Мы опишем самый простой и быстрый, с использование терминала. И в данном случае мы установим OpenJDK. OpenJDK — это бесплатная и свободная реализация виртуальной машины Java, причем очень популярная.

Откройте терминал и напишите команду для установки пакета:

Осталось подтвердить установку и на этом всё, Java установлена! Единственное, что меняется — это прописывание путей до компилятора.

Чтобы прописать JAVA_HOME в окружение, выполните следующую команду (только убедитесь, что такой каталог уже есть):

Чтобы прописать компилятор Java в PATH, выполните другую команду (опять же, ваши пути до Java могут отличаться от моих):

Читайте также:  Windows 10 не устанавливается драйвер samsung

На этом установка закончена. Чтобы проверить, что всё работает правильно, достаточно написать в терминале:

О том, как же всё-таки писать на Java, мы расскажем в следующий раз.

A Installing the Java Runtime Environment (JRE)

The Oracle GoldenGate Director software and installer both rely on components in the Java Runtime Environment (JRE). In many cases, this environment already exists because it was installed when the system was configured or when another program was installed. If the system where you are installing the server or client components does not have this environment, follow these instructions to download the JRE and verify the JRE environment on UNIX and Windows systems to support Oracle GoldenGate Director.

See System Requirements for the supported JRE versions.

Downloading the Java Runtime Environment

You can download the JRE free of charge from Oracle.

Under Java Platform, Standard Edition, select either the current release, or click Previous Releases to install an earlier supported version. You can use either the JDK or JRE. The JDK includes the JRE. Do not use any non-supported version or edition of the Java JRE or JDK.

Follow the navigation aids to download the JRE or JDK that is appropriate for your operating system.

Follow the installation instructions that are provided with the JRE.

Save the path to the JRE executable file. You will need it later.

Proceed to the instructions in Verifying the JRE Environment.

Verifying the JRE Environment

This section contains instructions for verifying the JRE environment on UNIX and Windows platforms.

Verifying the JRE on UNIX

After installing the JRE, run the following test to verify the version of Java that is recognized by the system.

From the command shell of the operating system, issue the following command.

Make certain the command output shows the version that you downloaded.

Verifying the JRE on Windows

After installing the JRE, but before installing Oracle GoldenGate Director Server, verify the path to the JRE by completing the following tasks:

Verify the JRE Version

These steps verify the JRE version that is installed on the server machine.

On the keyboard, press the Win (Windows) key and the R key simultaneously to open the Run box. Alternatively, you can select Start , then Run .

In the Run box, type cmd to run the Windows command console.

Issue the following command:

Do one of the following:

If the results show the JRE cversion that you installed, continue to the instructions in Installing Oracle GoldenGate Director Server.

If the results do not show that version, close the command console and continue with the steps in Set the JAVA_HOME System Variable.

Set the JAVA_HOME System Variable

These steps verify that the JAVA_HOME system environment variable points to the JRE that you installed, or creates the variable if absent.

On the desktop (Windows 2000) or in the Start menu (Windows XP), right-click My Computer and then click Properties .

Click the Advanced tab, and then click Environment Variables .

Under System Variables , look for the JAVA_HOME system variable. The JAVA_HOME path should point to the location that you recorded when you installed the JRE.

Do one of the following:

If you see the JAVA_HOME system variable and it points to the correct location, leave the Environment Variables dialog box open and follow the instructions in Set the JAVA_HOME System Path.

Читайте также:  Pages для windows аналоги

If a JAVA_HOME system variable does not exist, or if it points to the wrong location, continue to the next step.

Under System Variables , do one of the following:

Click New to create a JAVA_HOME variable.

Select the existing JAVA_HOME variable and then click Edit . This opens a dialog box to edit this variable.

In the Variable Name box, type JAVA_HOME in capital letters.

In the Variable Value box, type the correct path to the JRE.

Click OK to set the path and close the dialog box.

Leave the Environment Variables dialog box open and follow the instructions in Set the JAVA_HOME System Path.

Set the JAVA_HOME System Path

These steps ensure that the JAVA_HOME path is in the expected location within the Path system variable. Programs such as the Oracle database software place the path to their own JRE installations in the location that is expected by Oracle GoldenGate Director Server.

In the Environment Variables dialog box, look for the Path variable under System Variables .

Confirm that the path to JAVA_HOME appears as the first path in the list of paths.

Do one of the following:

If this JAVA_HOME path is the first path in the string, close the Environment Variables and System Properties dialog boxes and follow the instructions in Installing Oracle GoldenGate Director Server.

If this JAVA_HOME path is not the first path in the string, continue to the next step.

Under System Variables , double click the Path variable to open it for editing.

In the path string, locate the JAVA_HOME path. If it is there, cut and paste it (including the terminating semi-colon) to the front of the list; otherwise, type it. The path must be entered as %JAVA_HOME%\bin .

Click OK to close the Edit System Variable dialog box.

Close the Environment Variables and System Properties dialog boxes.

Where is java jre path specified in Windows 7?

I have java installed including jre 6 and 7 on Windows 7 64-bit. When I type java -version at the command line I get:

I wanted to make jre7 the default java from the command line so I went to edit my path when I notice java isn’t specified anywhere in either System Variables or User Variables (nor is there a JAVA_HOME variable either). Also running set from the command line confirms this as the Path variable has no java directory. My java is stored in the normal C:\Program Files\Java\jre6 .

So now I’m curious how is windows finding my current java on the command line?

2 Answers 2

Found a stackoverflow question which has the solution: JRE installation directory in Windows

Running where java gives the output:

(Didn’t realize windows had where command just knew it didn’t have which .) Curious how java.exe ended up there.

Update

This oracle article, Deploying the JRE on Windows, states that the Java installer will copy java.exe into the system directory:

By default, the installer places a copy of the runtime environment in the C:\Program Files\Java\jre1.6.0 directory. In addition, if no more recent version is already installed on the machine, the installer puts copies of the java and javaw application-launcher executables in the Microsoft Windows system directory. (The system directory varies depending on the Microsoft Windows version, but is usually either C:\winnt\system32 or C:\windows\system.)

Оцените статью