Java windows java oracle path

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.

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 двенадцатая.

Читайте также:  Stop what do you want windows to do

Ниже мы рассмотрим — как установить 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 могут отличаться от моих):

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

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

15 JDK Installation for Microsoft Windows

This page describes how to install and uninstall JDK 8 for Windows.

The page has these topics:

See «JDK 8 and JRE 8 Installation Start Here» for general information about installing JDK 8 and JRE 8.

System Requirements

See http://www.oracle.com/technetwork/java/javase/certconfig-2095354.html for information about supported platforms, operating systems, and browsers.

See «Windows System Requirements for JDK and JRE» for minimum processor, disk space, and memory requirements.

The JDK and JRE have a version string that enables you to determine the version number. See http://www.oracle.com/technetwork/java/javase/jdk8-naming-2157130.html for information about Java SE 8 version numbers.

The JDK has the option of installing the public JRE. For more information about JRE installation, see «JRE Installation for Microsoft Windows».

Installation Instructions Notation

For any text in this document that contains the following notation, you must substitute the appropriate update version number:

For example, if you were downloading the JDK installer for 32-bit systems for update 1.8.0_01, the file name: jdk-8 version -windows-i586.exe becomes jdk-8u1-windows-i586.exe .

Similarly, if you were downloading the JDK installer for 64-bit systems for update 1.8.0_01, the file name jdk-8 version -windows-x64.exe becomes jdk-8u1-windows-x64.exe .

Installation Instructions

In these instructions, you run the self-installing executable file to unpack and install the JDK. As part of the JDK, this installation includes an option to include the public Java Runtime Environment. (The JDK also contains a private JRE for use only by its tools; see «Private Versus Public JRE» for more information.)

Install the JDK by doing the following:

Downloading the Installer

If you save the self-installing executable file to disk without running it from the download page at the web site, note the file size specified on the download page. After the download has completed, verify that you have downloaded the complete file.

Читайте также:  Windows recent files что это

Running the JDK Installer

You must have administrative permissions in order to install the JDK on Microsoft Windows.

The file jdk-8 version -windows-i586-i.exe is the JDK installer for 32-bit systems. The file jdk-8 version -windows-x64.exe is the JDK installer for 64-bit systems. If you downloaded either file instead of running it directly from the web site, double-click the installer’s icon. Then, follow the instructions the installer provides. When finished with the installation, you can delete the downloaded file to recover disk space.

Installers for JDK 7u6 and later install the JavaFX SDK and integrate it into the JDK installation directory. Installers for JDK 7u2 to 7u5 install the JDK first, then start the JavaFX SDK installer, which installs JavaFX SDK in the default directory C:\Program Files\Oracle\JavaFX 2.0 SDK or C:\Program Files (x86)\Oracle\JavaFX 2.0 SDK on 64-bit operating systems. If you want to install the JavaFX SDK (version 2.0.2) with JDK 7u1 or earlier, see http://docs.oracle.com/javafx/2/installation/jfxpub-installation.htm for more information.

Java Start Menu

Starting with JDK 7u40 release, Java menu items are added to the Windows Start Menu to provide easy access to Java resources.

During JDK install, a Java Development Kit folder is created in the Windows Start Menu, which contains the following items:

Reference Documentation: Opens the Online API documentation web page.

Java Mission Control: Opens the Java Mission Control profiling and diagnostics tools suite.

During JDK install and uninstall processes, the appropriate start menu items are updated to be associated with the latest JDK version on the system

Java Mission Control is a commercial feature available to users with a Java SE Advanced license.

Installing the JDK Silently

Instead of double-clicking or opening the installer, you can perform a silent, non-interactive, JDK installation by using the command-line arguments. The following table lists example installation scenarios and the commands required to perform them. The notation jdk stands for the downloaded installer file base name, such as jdk-8u05-windows-i586 .

Installation Scenario Command
Install the public JRE in silent mode
Install development tools and source code in silent mode but not the public JRE
Install development tools, source code, and the public JRE in silent mode
Install the public JRE in the specified directory C:\test\ in silent mode

Updating the PATH Environment Variable

If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

It is useful to set the PATH variable permanently so it will persist after rebooting.

To set the PATH variable permanently, add the full path of the jdk1.8.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.8.0\bin . Set the PATH variable as follows on Microsoft Windows:

Click Start, then Control Panel, then System.

Click Advanced, then Environment Variables.

Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value for the PATH variable:

The PATH environment variable is a series of directories separated by semicolons ( ; ) and is not case-sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.

You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.

If you are not sure where to add the JDK path, append it.

The new path takes effect in each new command window you open after setting the PATH variable.

Starting to Use the JDK

Use the Java item in the Windows Start menu to get access to essential Java information and functions, including help, API documentation, the Java Control Panel, checking for updates, and Java Mission Control.

If you are new to developing and running programs in the Java programming language, see http://docs.oracle.com/javase/tutorial for some guidance. Note especially the tutorial trails under the heading Trails Covering the Basics.

Uninstalling the JDK

To uninstall the JDK, use the «Add/Remove Programs» utility in the Microsoft Windows Control Panel.

Uninstalling the JDK in Silent Mode

You can use the command line for uninstalling the JDK.

For example, to uninstall Java 8 update 251, run the command:

This command can be run from anywhere.

The msiexec.exe executable is located in the windows system directory.

A reboot is required only if some files are in use during uninstallation; it is not necessary everytime. However, to manually suppress reboot while uninstalling, append REBOOT=R option to the command.

setup.log» option to the command if you want to create a log file describing the uninstallation status.

Windows Installer dialog appears prompting you for confirmation. Click Yes to uninstall JDK.

Finding the JDK Registry Key and UninstallString Value

Go to Start and type regedit.

In the Registry Editor, go to HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Uninstall .

Under the Uninstall folder, you will find many registry entries within curly brackets.

Click Edit and then Find.

Highlight Uninstall folder before performing search for a particular registry.

Enter version string as value to find corresponding registry key. Follow format 1.8.0.xxx. For example, enter jre1.8.0.251.

The registry key is highlighted on the right-hand side of the pane and values of various uninstall strings are displayed on the left-hand pane.

Note the value of the UninstallString.

Installed Directory Tree

See http://docs.oracle.com/javase/8/docs/technotes/tools/windows/jdkfiles.html for a description of the directory structure of the JDK. (Note that the file structure of the JRE is identical to that of the JDK’s jre directory.)

Installation Troubleshooting

Below are some tips for working around problems that are sometimes seen during or following an installation:

Corrupt Cabinet File

If you see the error message «corrupt cabinet file,» then the file you have downloaded is corrupted. Check the file size against the expected file size listed in these instructions. If sizes do not match, try downloading the bundle again. (A cabinet file contains compressed application, data, resource, and DLL files.)

System Error During Decompression

If you see the error message «system error during decompression,» then you might not have enough space on the disk that contains your TEMP directory.

Program Cannot Be Run in DOS Mode

If you see the error message «This program cannot be run in DOS mode,» then do the following:

Open the MS-DOS shell or Command Prompt window.

Right-click the title bar.

Choose the Program tab.

Click the Advanced button.

Ensure that the item «Prevent MS-DOS-based programs from detecting Windows» is not selected.

Select OK again.

Exit the MS-DOS shell.

Restart your computer.

Private Versus Public JRE

Installing the JDK also installs a private JRE and optionally a public copy. The private JRE is required to run the tools included with the JDK. It has no registry settings and is contained entirely in a jre directory (typically at C:\Program Files\jdk1.8.0\jre ) whose location is known only to the JDK. On the other hand, the public JRE can be used by other Java applications, is contained outside the JDK (typically at C:\Program Files\Java\jre1.8.0 ), is registered with the Windows registry (at HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft ), can be removed using Add/Remove Programs, might be registered with browsers, and might have the java.exe file copied to the Windows system directory (which would make it the default system Java platform).

Source Files in Notepad

In Microsoft Windows, when you create a new file in Microsoft Notepad and then save it for the first time, Notepad usually adds the .txt extension to the file name. Therefore, a file you name Test.java is saved as Test.java.txt . It is important to note that you cannot see the .txt extension unless you turn on the viewing of file extensions (in Microsoft Windows Explorer, unselect «Hide file extensions for known file types» under Folder Options). To prevent the .txt extension, enclose the file name in quotation marks, such as «Test.java» , when typing it into the Save As dialog box.

On the other hand, Microsoft WordPad does not add the .txt extension if you specify another extension. However, you must save the file as «Text Document».

Characters That Are Not Part of the System Code Page

It is possible to name directories using characters that are not part of the system locale’s code page. If such a directory is part of the installation path, then generic error 1722 occurs, and installation is not completed. Error 1722 is a Windows Installer error code. It indicates that the installation process has failed. The exact reason for this error is not known at this time.

To prevent this problem, ensure that the user and system locales are identical, and that the installation path contains only characters that are part of the system locale’s code page. User and system locales can be set in the Regional Options or Regional Settings control panel.

Читайте также:  Bedrooms with large windows
Оцените статью