[JAVA] [Summary] What I noticed and did when I was told that the Oracle JDK was paid

Introduction

2020/4/16 update The original article was quite error-prone, so I drastically corrected the article. Thank you for pointing out.

Only the part of the experience story that there was a way to find and a stumbling point when rolling the JDK in various places Please for your reference.

Also, as is well known, the Oracle JDK "It can be used free of charge for personal use and development use."

It should only be considered for commercial and associated environments.

Reference article

-Guide to switching to OpenJDK due to the charge for Oracle Java SE -Three JDKs to consider when using Java for free for commercial use


The following is a modified version of the original article

Background

When creating an in-house development environment on a Windows PC, the procedure was to install the Oracle JDK, but I heard that this time it was charged. [^ 1]

However, if you look closely at the test environment, it was OpenJDK [^ 2], so I thought about migrating Java 8 to OpenJDK on Windows. [^ 1]: The pages around here are easy to understand because they include interpretations. https://www.orangeitems.com/entry/2018/09/26/152343 [^ 2]: Since the OS on the server side uses Redhat Enterprise linux, I wonder if it is a set license form. (I haven't seen the material) https://access.redhat.com/ja/articles/1457743

Step

First from the pre-state

C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_161

--javac version

C:\>javac -version
javac 1.8.0_161

--java version

C:\>java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

that? The version of java is different ...% JAVA_HOME% I wonder if the old settings remain because they haven't seen it ... Well, what?

Guguru for the time being

Basically, do not perform the following procedure. The reason will be described later. --apt-get yum Farewell to the environment where you can use it https://openjdk.java.net/install/

Install & deploy

Make an Accept License Agreement and download the zip. The oracle JDK folder was organized as shown below, so I put it here. --oracle: jdk1.8.0_161 (the one that runs when javac), jre1.8.0_211 (the one that runs when java) --open: java-se-8u40-ri (the one I want you to run when javac``java)

image.png

Path setting

javac First of all, if you change % JAVA_HOME%, you can get javac.

C:\>echo %JAVA_HOME%
C:\Program Files\Java\java-se-8u40-ri

--javac version

C:\>javac -version
javac 1.8.0_40

It's changed

java

C:\>java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

So, it didn't change, so if you look closely at % PATH% ...

C:\ProgramData\Oracle\Java\javapath
C:\Program Files (x86)\Common Files\Oracle\Java\javapath

There was such a thing. what's this → Guguru http://ooltcloud.sakura.ne.jp/blog/201802/article_09182611.html

 C:\ProgramData\Oracle\Java\javapath directory

2018/04/24  08:54    <DIR>          .
2018/04/24  08:54    <DIR>          ..
2018/04/24  08:53           207,816 java.exe
2018/04/24  08:53           208,328 javaw.exe
2018/04/24  08:53           354,248 javaws.exe
3 files 770,392 bytes
2 directories 349,382,586,368 bytes of free space

C:\ProgramData\Oracle\Java\javapath>
 C:\Program Files (x86)\Common Files\Oracle\Java\javapath directory

2019/04/18  09:01    <DIR>          .
2019/04/18  09:01    <DIR>          ..
2019/04/18  08:59           207,736 java.exe
2019/04/18  08:59           208,248 javaw.exe
2019/04/18  08:59           354,168 javaws.exe
3 files 770,152 bytes
2 directories 349,428,879,360 bytes of free space

C:\Program Files (x86)\Common Files\Oracle\Java\javapath>

Apparently, it seems that java.exe here and there was used & it was set arbitrarily when JRE was installed. → Never delete (or lower the order in % PATH%).

C:\>java -version
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK Client VM (build 25.40-b25, mixed mode)

I got it

Bad place

https://jdk.java.net/java-se-ri/8-MR3 These binaries are for reference use only!

I was ignoring what was written as big. It was inappropriate because it should be used for reference.

What to really do

For example, in this case, do you have a Red Hat license first? It was good to hear that. If not, I should have searched for the article of the ancestor. Most people should be stuck.

Recommended Posts

[Summary] What I noticed and did when I was told that the Oracle JDK was paid
Notes on errors that occur when installing the JDK and countermeasures that I have tried
This and that of the JDK
What I did when the DB did not start with docker-compose up
Memorandum: What I was addicted to when I hit the accounting freee API
What I did when JSF couldn't display database information in the view
What I did when I was addicted to the error "Could not find XXX in any of the sources" when I added a Gem and built it
In WSL2, when I did `docker-compose up`, I got an error saying that the sh file was not found.
A story that I was really into when I did triple DES with ruby
What I did when I converted java to Kotlin
The story that did not disappear when I tried to delete mysql on ubuntu
What I did to get out of the first wall I was assigned to the SRE team and bumped into, "What should I start with?"
[Ruby] Misunderstanding that I was using the module [Beginner]
Now in the third year, the misunderstanding that I noticed is the difference between the equals method and ==