Click here for AWS Cloud9 introduction https://qiita.com/tu-kun/items/d7b4f1fa19cc93bc5b75
--People who want to upgrade to Java 8 on AWS Cloud9 --People who are not sure but want to introduce Java 8
Java
$ java -version
java version "1.7.0_181"
OpenJDK Runtime Environment (amzn-x.x.xx.x.xx.amzn1-x86_64 u181-b00)
OpenJDK 64-Bit Server VM (build xx.xxx-b00, mixed mode)
Javac
$ javac -version
javac 1.7.0_181
The java8 package is java-1.8.0-openjdk-devel
.
This is a package that also installs OpenJDK for developers.
$ yum search java-1.8.0-openjdk-devel
Loaded plugins: priorities, update-motd, upgrade-helper
epel 12509/12509
1045 packages excluded due to repository priority protections
================================================ N/S matched: java-1.8.0-openjdk ================================================
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK API Documentation compressed in single archive
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
Yum install must be run as the root user, so prefix it with the sudo command.
y
because there is a place to interact with ʻIs this ok [y / d / N]:` on the way.$ sudo yum install java-1.8.0-openjdk-devel
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.5 kB 00:00:00
1045 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.171-7.b10.37.amzn1 will be installed
--> Processing Dependency: java-1.8.0-openjdk(x86-64) = 1:1.8.0.171-7.b10.37.amzn1 for package: 1:java-1.8.0-openjdk-devel-1.8.0.171-7.b10.37.amzn1.x86_64
--> Processing Dependency: libawt_xawt.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-devel-1.8.0.171-7.b10.37.amzn1.x86_64
--> Processing Dependency: libawt_xawt.so()(64bit) for package: 1:java-1.8.0-openjdk-devel-1.8.0.171-7.b10.37.amzn1.x86_64
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.171-7.b10.37.amzn1 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.171-7.b10.37.amzn1 for package: 1:java-1.8.0-openjdk-1.8.0.171-7.b10.37.amzn1.x86_64
--> Running transaction check
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.171-7.b10.37.amzn1 will be installed
amzn-main/latest/filelists_db | 5.7 MB 00:00:13
amzn-updates/latest/filelists_db | 1.2 MB 00:00:00
epel/x86_64/filelists | 7.3 MB 00:00:01
--> Processing Dependency: copy-jdk-configs >= 1.1-3 for package: 1:java-1.8.0-openjdk-headless-1.8.0.171-7.b10.37.amzn1.x86_64
--> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.171-7.b10.37.amzn1.x86_64
--> Running transaction check
---> Package copy-jdk-configs.noarch 0:1.2-1.2.amzn1 will be installed
---> Package lksctp-tools.x86_64 0:1.0.10-7.7.amzn1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================
Installing:
java-1.8.0-openjdk-devel x86_64 1:1.8.0.171-7.b10.37.amzn1 amzn-updates 12 M
Installing for dependencies:
copy-jdk-configs noarch 1.2-1.2.amzn1 amzn-main 13 k
java-1.8.0-openjdk x86_64 1:1.8.0.171-7.b10.37.amzn1 amzn-updates 249 k
java-1.8.0-openjdk-headless x86_64 1:1.8.0.171-7.b10.37.amzn1 amzn-updates 39 M
lksctp-tools x86_64 1.0.10-7.7.amzn1 amzn-main 89 k
Transaction Summary
=================================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 51 M
Installed size: 144 M
Is this ok [y/d/N]: Y
Downloading packages:
(1/5): copy-jdk-configs-1.2-1.2.amzn1.noarch.rpm | 13 kB 00:00:00
(2/5): java-1.8.0-openjdk-1.8.0.171-7.b10.37.amzn1.x86_64.rpm | 249 kB 00:00:05
(3/5): lksctp-tools-1.0.10-7.7.amzn1.x86_64.rpm | 89 kB 00:00:02
(4/5): java-1.8.0-openjdk-devel-1.8.0.171-7.b10.37.amzn1.x86_64.rpm | 12 MB 00:00:15
(5/5): java-1.8.0-openjdk-headless-1.8.0.171-7.b10.37.amzn1.x86_64.rpm | 39 MB 00:00:16
---------------------------------------------------------------------------------------------------------------------------------
Total 2.3 MB/s | 51 MB 00:00:21
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : copy-jdk-configs-1.2-1.2.amzn1.noarch 1/5
Installing : lksctp-tools-1.0.10-7.7.amzn1.x86_64 2/5
Installing : 1:java-1.8.0-openjdk-1.8.0.171-7.b10.37.amzn1.x86_64 3/5
Installing : 1:java-1.8.0-openjdk-headless-1.8.0.171-7.b10.37.amzn1.x86_64 4/5
Installing : 1:java-1.8.0-openjdk-devel-1.8.0.171-7.b10.37.amzn1.x86_64 5/5
Verifying : 1:java-1.8.0-openjdk-devel-1.8.0.171-7.b10.37.amzn1.x86_64 1/5
Verifying : 1:java-1.8.0-openjdk-1.8.0.171-7.b10.37.amzn1.x86_64 2/5
Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.171-7.b10.37.amzn1.x86_64 3/5
Verifying : lksctp-tools-1.0.10-7.7.amzn1.x86_64 4/5
Verifying : copy-jdk-configs-1.2-1.2.amzn1.noarch 5/5
Installed:
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.171-7.b10.37.amzn1
Dependency Installed:
copy-jdk-configs.noarch 0:1.2-1.2.amzn1 java-1.8.0-openjdk.x86_64 1:1.8.0.171-7.b10.37.amzn1
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.171-7.b10.37.amzn1 lksctp-tools.x86_64 0:1.0.10-7.7.amzn1
Complete!
Since AWS uses alternatives for java version control, you need to switch rather than just install it.
The version of java prefixed with * +
is the currently applied version.
ʻEnter to keep the current selection [+], or type selection number: There is a place to interact with , so enter
2` which is jre-1.8.0.
Java
$ sudo alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
Enter to keep the current selection[+], or type selection number: 2
Javac
$ sudo alternatives --config javac
There are 2 programs which provide 'javac'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/java-1.7.0-openjdk.x86_64/bin/javac
2 /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac
Enter to keep the current selection[+], or type selection number: 2
Finally, check the version, and if it changes to 1.8.0, you're done.
$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
$ javac -version
javac 1.8.0_171
Not only will you be happy with the installation, but don't forget to switch!
Recommended Posts