Как установить java home windows 10
Перейти к содержимому

Как установить java home windows 10

  • автор:

Как установить JAVA_HOME в Windows 10

В терминологии Unix переменная среды представляет собой строку, содержащую информацию, такую как имя диска, имя пути, имя файла и т. Д. JAVA_HOME это переменная среды, которая обращается к каталогу, в котором установлена среда Java Runtime Environment или Java Development Kit. Если быть точным, если вы установили Java в путь C: Program Files Java jdk1.8.0_121 на вашем компьютере, то ваш java_home является C: Program Files Java jdk1.8.0_121, В принципе, JAVA_Home является просто образцовым примером использования Java-программ, таких как Apache Tomcat и других инструментов сервера приложений, чтобы найти место размещения Java в системе.

Эти сторонние программы используют переменные среды, указывающие на каталог JDK или JRE. Говоря простыми словами, программам легко найти исполняемый файл каталога, такой как javac на компьютере. Если вы не используете эти сторонние программы, для пользователей может быть не обязательно настраивать JAVA_Home в вашей системе. В этой статье мы подробно объясним, как установить JAVA_HOME в качестве переменной среды в Windows 10.

Установка JAVA_HOME в Windows 10

Установите переменную среды JAVA_HOME и обновите системный путь

Загрузите и установите Java с официального сайта — java.com.

После установки перейдите к Начните меню и введите Расширенные настройки системы.

Нажмите на Просмотр расширенных настроек системы из списка, чтобы открыть Свойства системы.

Идти к продвинутый и нажмите Переменная средыs.

В окне «Переменная среда» нажмите новый под системной переменной.

в редактировать System Variable, укажите имя переменной как JAVA_HOME и значение Variable как путь к вашему каталогу JDK.

Нажмите на Хорошо.

Теперь вернитесь в окно Environment Variable и выберите Путь под системной переменной.

Нажмите на редактировать, чтобы открыть окно изменения среды редактирования.

Нажмите кнопку «Создать» и введите% JAVA_HOME% Bin.

Нажмите Хорошо для внесения изменений.

Проверьте настройку конфигурации JAVA_HOME с помощью CMD

Чтобы проверить конфигурацию, откройте Командная строка.

Тип echo% JAVA_HOME% и нажмите Enter. Это должно печатать каталог JDK, который указывает JAVA_HOME. Вместо этого, если вы видите пробел, это означает, что вам не удалось настроить переменную окружения.

Следующий тип javac -version который должен печатать версию Java-компилятора.

Если нет, он выведет сообщение о том, что javac не распознается как внутренняя или внешняя команда. Это означает, что переменная пути задана неправильно.

Надеюсь это поможет!

Похожие сообщения:

  • Переменные System & User Environment в Windows объясняются
  • Удаление или отключение Java в Internet Explorer, Firefox, Chrome, Opera
  • Безопасное пребывание в Интернете с помощью Java; или безопаснее без него!
  • Советы по безопасному использованию Java в Windows 10
  • Понимание и управление настройками Java в Windows 10/8/7

Популярная тема

Как установить и установить бета-версию Windows Home Server «Вейл» на VirtualBox

Если у вас нет дополнительной машины или у вас есть ранний усыновитель, который хочет проверить Vail, создание виртуальной машины — хороший выбор. Чтобы завершить нашу серию установки WHS «Vail» Beta практически, мы рассмотрим ее установку на VirtualBox Oracle.

Как установить Ethernet-соединение как измеренное в Windows 8 и 10

Windows 8 и 10 позволяют устанавливать определенные типы подключений как измеренные, чтобы можно было ограничить объем данных, которые могут использовать Windows (и некоторые приложения), не спрашивая. Вы можете использовать обычный интерфейс настроек для установки мобильных и Wi-Fi-соединений в качестве дозированных, но по какой-то причине Windows предполагает, что вам не нужно будет делать это с помощью проводных Ethernet-соединений. Если вы используете интернет-провайдера

Как установить Spotify как ваш поставщик музыки по умолчанию на Amazon Echo

До сих пор, если вы хотели играть музыку Spotify на Amazon Echo, вам нужно было сказать исполнителя или песню, которую вы хотели сыграть, а затем зацепиться «на Spotify» в конце. Это немного громоздко, но теперь вам больше не нужно это делать, поскольку вы можете установить Spotify в качестве вашего музыкального провайдера по умолчанию Echo.

Как установить и установить Windows Home Server «Вейл» в VMware Player

Новая бета-версия Windows Home Server доступна для публики для тестирования, и у вас может не быть дополнительной машины для ее установки. Здесь мы рассмотрим использование бесплатного VMware Player для его установки, чтобы вы могли проверить его.

Как установить и установить Windows Home Server

Вы когда-нибудь хотели иметь доступ ко всем своим важным файлам, музыке, фотографиям и т. Д. Со всех компьютеров в вашем доме с одного центрального сервера? Сегодня мы рассмотрим Windows Home Server и покажем вам, как установить и настроить его с помощью других компьютеров в вашей сети.

Как установить JAVA_HOME в Windows 10?

Этот урок покажет вам, как установить JAVA_HOME системная переменная в Windows 10.

  1. Windows 10
  2. JDK 1.8

1. Расширенные настройки системы

Тип advanced system settings в окне поиска (рядом с кнопкой запуска Windows) нажимает View advanced system settings ,

2. Переменные среды

Выбрать Advance вкладка, клики Environment Variables

3. Добавьте JAVA_HOME

В системных переменных клики New. кнопка, чтобы добавить новый JAVA_HOME Переменная и укажите его в установленной папке JDK.

Заметка
Не включайте bin папка, просто путь JDK. Например

  1. Исправить — C: / Program Files / Java / jdk1.8.0_60
  2. Неправильно — C: / Program Files / Java / jdk1.8.0_60 / bin

4. Обновить PATH

В системных переменных найдите PATH клики edit. кнопка:

4.1 В старой версии Windows, ниже диалоговое окно предложит вам редактировать значения напрямую, добавьте это %JAVA_HOME%bin; до конца строки.

4.2 В последней версии Windows 10 появится диалоговое окно, нажав на New и добавьте это %JAVA_HOME%bin

Заметка
Ставит %JAVA_HOME%bin в PATH сделать все команды Java (java, javac, jstack и т. д.) доступными из любого места.

Setting Up a Java Development Environment on Windows

Matt Speake

In this guide, we’re going to give you the low down on how to set up your machine so that you can develop Java programs. Let’s jump in!

Overview

So, from a high level all you need to do is the following:

  1. Download and install the JDK (Java Development Kit) — this is the Java platform itself which contains all the tools you need to be able to write and run Java programs
  2. Set up some environment variables — these let other apps know where yo installed the JDK to and allow Windows to ‘see’ the tools in the JDK so you and other programs can actually use them.
  3. Download and install an IDE (Integrated Development Environment) — this is the ‘proper application’ you’ll use each day which allows you to type in, edit and run your Java programs.

Whether you’re a highly-experienced Java software engineer working at Google, Facebook or Netflix, or you’re a fresh intern starting out in a bank, these are the tools which all professional Java software engineers have to install once, and use every day to code Java.

Instructions

Downloading and Installing the JDK

Step 1: Find out which version of Windows you have

  • Click the Windows Start button, type the first few letters of ‘about’ in the search text box, and click About your PC from the results.
  • From the dialog which appears, you’ll be able to see if you have a 32-bit or 64-bit version of Windows. This will be in the About section, labelled as System Type:

The description might not say explicitly, but use this as a guide to work out which one you have:

Step 2: Download the correct JDK for your Windows version

So now you know if you have a 32-bit or 64-bit version of Windows, you can download the JDK which works on your system (i.e. a 64 bit version won’t run on a 32-bit version of Windows etc.)

  • Go to your favourite web browser (I hope that’s Google Chrome — that’s mine!), and search for “jdk download”, clicking on the first link which appears if it looks like this:

You’ll end up at the Downloads Page for the JDK on Oracle’s website which is https://www.oracle.com/uk/java/technologies/javase-downloads.html at the time this is written, but is subject to change (which is why we get you to look it up through Google instead).

  • Scroll down to the Java SE 8 section (this is the best version for beginners to get started with and is the most popular version currently in industry), and click the JDK Download link:
  • You’ll be taken to the page which shows all the different versions of the JDK that can be downloaded. There are versions here for Linux, Solaris, Mac and — right at the bottom (so scroll down again!) — for Windows:
  • Click the correct version for your system (you’ll know whether to get the 32- or 64-bit version from the earlier step, remember).

NOTE: you’ll need to accept the agreement and have an account on the Oracle website to download; it’s free to create one and simple to do if you don’t — so create one at this step if you need to, then you’ll be able to download the JDK you selected.

Step 3: Install the JDK you just downloaded

  • You can run the installer directly as soon as it has finished downloading (or optionally save the install file first to a directory you want to keep it in and run from there — sometimes it’s nice to keep the installers for applications you install, that’s what I do, but it’s up to you). To do this, click Run. A popup will appear asking if you’re happy for the installer to make changes to your device, click Yes.
  • When you go through the installation wizard at this point, you’ll click Next through each page of the installer with one important exception though: change the JDK install location from this screen by clicking Change:

Change the path to a folder which doesn’t contain any spaces: on my Windows systems, I’ll use something like C:\tools where I place all my development tools into — so you might like to choose something similar:

NOTE: Be sure to note this folder path down as you’ll use it later when setting up the environment variables.

Click OK to confirm this and step through the rest of the installation wizard by clicking Next for each step.

Once you’ve done this, the JDK has been installed on your system!

Setting up the Environment Variables

Next up we need to set up two important environment variables:

  • Go into Windows Explorer by pressing the Windows key and E ( Win + E ).
  • Right-click on the This PC node in the left-hand navigation pane, and select Properties:
  • Click the Advanced System Settings link:
  • You’re now at the System Properties dialog where you can configure Windows:
  • Click the Environment Variables… button to go to the Environment Variables dialog:

This is the screen where we’ll set up our environment variables.

Step 1: Creating the JAVA_HOME environment variable

  • In the System Variables section, click the New… button.
  • In the pop-up dialog, type the values as follows (adapting the path I have here for the one you noted down when you installed the JDK earlier — if you didn’t do this, you can just flick back to Windows Explorer, navigate to where you downloaded the JDK to, and right-click in the address bar to copy the value, then paste it here instead):
  • Click OK when you’re done, and you’ll now see the value defined in the Environment Variables dialog:

Step 2: Adding the JDK tools to the System Path environment variable

Next, we’ll add the tools in the JDK folder, which are located in the bin subdirectory of this) to our System Path.

  • From the Environment Variables dialog, click the Path entry in the System Variables pane, then click the Edit… button. You’ll be taken to the edit dialog which allows you to add to the environment variable:

What you’re seeing here is a list of locations where Windows will look in to try and find the programs which correspond to the commands you type from a DOS prompt.

What we need to do now then, is make sure that we add the JDK tools directory to the top of this list — so it becomes the first place Windows will look in (and therefore override the current first entry which is where Windows puts a JRE — this will confuse our development environment, so we override it so the JDK tools we downloaded take precedence over anything shipped with Windows itself — as far as Java is concerned that is (don’t worry — it won’t affect anything besides Java!).

  • Click New… and add %JAVA_HOME%\bin — the percentage signs mean "expand to the real value in the environment variable" when Windows looks at it — i.e. it will expand to the actual path you entered before (so this will become something like C:\tools\jdk1.8.0_291\bin when Windows evaluates it when trying to — and successfully being able to — resolve the JDK commands you type in a Dos Prompt).
  • Now click Move Up several times until this newly-created entry is at the top of the list:
  • Now type the following commands to check your setup:

NOTE: all the versions should show the same as the version of the JDK you downloaded — if they do, you’re good to go! Well done! 😉

Downloading and Installing an IDE

Good news! The IDE is the easiest part of the whole process!

NOTE: Even though we do our actual programming inside this application, it was still important to do the other earlier steps though to ensure our development environment was properly configured since the IDE relies on being able to locate the JDK and the tools inside it (e.g. for compiling your Java code (with the javac command, which is the Java compiler) and being able to run it afterwards (with the java command, which is the Java Virtual Machine).

  • Go to the Jetbrains website (Jetbrains is the company which makes the IntelliJ IDEA — this is the IDE we’ll download and install) and click the Download button.
  • Go to click the Other Versions on the left underneath the IDEA logo.

NOTE: We’re going to download an older version — the most recent 2018 version. This may seem strange, but in my opinion it’s easier for beginners. Ironically, Jetbrains added some extra features to try and make it easier for beginners, but I personally think they’re too confusing and therefore the version before they added these changes are better for you, so we’ll download this version.

  • You’ll be taken to the downloads page:
  • Click the link 2018.3.6 — Windows (exe) to download IDEA.
  • Once IDEA has downloaded, click Run, agree to the allow changes dialog (like we did earlier for the JDK install), and just accept all default options and click Next throughout the installation wizard.
  • Once IDEA has installed successfully, you’ll see the success dialog — click Finish to launch IDEA:
  • Select Do Not Import Settings (since you haven’t installed IDEA before), click OK.
  • Select the checkbox to agree to the license agreement, click OK.
  • Now we’re in the customization dialog, so just click Skip remaining and Set Defaults.
  • At this point, you’ll be greeted with the start screen of IDEA:

Well done — you’ve successfully installed IntelliJ IDEA and can now start creating projects and start coding in Java! 😉

Where Next?

If you enjoyed this or prefer to follow along by video, go grab our Java Beginners Starter Kit to jump start your Java journey and learn Java from scratch!

How To Install Java on Windows 10 Step by Step

In this short tutorial, we’re going to take a close look at how to install Java on Windows 10.

We’ll first start with a little insight into how to download Java. Then, we’ll explain how to install it on Windows 10. Then, we’re going to see how to properly set JAVA_HOME environment variable.

Lastly, we’ll highlight different ways to check Java and JDK versions on Windows 10.

So, let’s get started

Download Java for Windows 10

In this section, we’re going to cover in-depth all the steps required to download Java for Windows 10.

As a matter of fact, downloading Java is a piece of cake. It’s just a matter of a few clicks and simple one-time steps.

First, we need to visit the official oracle download page and choose the right release for the Java SE Platform. At this point in time, the latest version is Java 18.

Secondarily, we need to click on the Windows tab.

Bear in mind that Oracle has dropped the support for 32 bit systems. As a result, we can use Java SE only in 64 bit machines.

Oracle offers three options to install Java on Windows. We can use a compressed archive file, a x64 Installer or a x64 MSI Installer.

For instance, let’s choose the x64 Installer option:

Before Java 17, we had to accept the Oracle Technology Network License Agreement to proceed to the next step, which is not the case for Java 18

Lastly, a simple click on the download link will do the job. Easy, right?

Install Java on Windows 10

Now that we downloaded Java for Windows 10, let’s see how to install it.

Basically, the process of installing Java on Windows 10 is pretty easy and simple.

In general, we don’t need to change anything during the installation, we can go with the default settings and follow the suggested instructions.

Firstly, we need to double click on the downloaded installer file to start the installation process:

Secondarily, we click Next to continue:

Note that, “C:\Program Files\Java\” is the default Java installation folder! However, we can always change it if we want that.

Then, we keep hitting Next until the installation is complete:

Finally, we close the installer wizard to complete the installation.

Set Java Path in Windows 10

Now that we have installed Java with success, it’s time to proceed to the next step.

In this short chapter, we’re going to dive deep into how to set JAVA_HOME environment variable on Windows 10.

Add JAVA_HOME

The basic idea behind setting the Java Path is to make all the Java commands like java and javac accessible from everywhere. That way, we can run Java programs from anywhere.

Please note that, JAVA_HOME should point to the JDK not the JRE.

First, let’s open the Advanced System Settings. To do that, we just need to press Windows key + Pause Key.

Alternatively, we can type View advanced system settings in the search box.

Once the System Properties window is opened, we click on Environment Variables:

Secondarily, we click on the New button to create a new environment variable with JAVA_HOME as name and the path to the JDK directory as value:

As we can see, the JAVA_HOME environment variable points to the JDK folder which C:\Program Files\Java\jdk-18.0.1.1 is in our case.

Append JAVA_HOME to PATH

Next, we need to update the PATH variable by adding a new entry for %JAVA_HOME\bin%:

Finally, we can click OK to save and apply the changes.

That’s all we can say about downloading and installing java on windows 10. Now, we’re ready to write our first Java program.

Check Java Version on Windows 10

There are multiple ways that we can use to check Java version on Windows 10. The most obvious and basic way is to use the terminal.

Firstly, press Win+R and type cmd to open the Command Prompt. After that, type java -version and press Enter:

The output means that Java is properly installed on our operating system.

Alternatively, we can type “Java” in the search box and click on “About Java”:

Please bear in mind that multiple versions of JDK can be installed on the same on Windows 10 machine. So, it’s important to make sure the JAVA_HOME environment variable points to the right JDK release.

Let’s open a new command prompt and type:

As show above, the environment variable JAVA_HOME points to the directory of the lastest JDK version.

We can also use javac -version to verify the version of the installed JDK:

Another important thing to note here is that the JDK version can be different from the JRE version on the same machine.

Please keep in mind that we need always to check for new Java updates and install them to keep our machines up-to-date with the latest releases.

In case you want to check how to enable Java on Chrome and other browsers, feel free to take a look at this article: https://devwithus.com/enable-java-chrome/

Write First Java Program

Now that we installed Java, let’s see how to create our first Java program.

To do so, let’s open an IDE or a text editor of your choice, for example, Notepad++, and create a new file (ctrl+n).

Next, we need to append the following code in our newely created file:

Now, let’s save our file anywhere we want under the name: HelloTest.java

In order to execute our Java program, we need to compile it first. So, let’s open a terminal and type:

As we can see, javac creates a new file with the name HelloTest.class. This means that the compilation phase is done with success.

Lastly, let’s run our Java program using the java command:

Please bear in mind that we don’t need to specify the extension when executing a Java file.

Conclusion

In this article, we’ve explained how to tackle the challenge of downloading and installing Java on Windows 10. Then, we’ve seen how to add JAVA_HOME and append %JAVA_HOME\bin% to the Path.

Lastly, we have showcased how to verify and check the installed Java version.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *