• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

chrishantha/install-java: Installation script for setting up Java on Linux

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

chrishantha/install-java

开源软件地址:

https://github.com/chrishantha/install-java

开源编程语言:

Shell 100.0%

开源软件介绍:

Java Development Kit (JDK) installation script for Linux

"install-java.sh" is an installation script for setting up Java Development Kit (JDK) on Debian based Linux Operating Systems.

Currently, the install-java.sh script supports tar.gz distributions from Oracle, OpenJDK and AdoptOpenJDK

I'm mainly using Ubuntu and therefore this script is tested only on different versions of Ubuntu.

Prerequisites

The script uses "unzip" command. Therefore, please make sure it is installed.

sudo apt install unzip

The "install-java.sh" script will not download the Java distribution. You must download JDK tar.gz distribution.

For Oracle JDK 7 & 8, install-java.sh supports installing demos and "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files". This files are picked up from the same directory.

For example, if you want to install Java 7, then the following files should be downloaded and moved to a single directory.

  • jdk-7u80-linux-x64.tar.gz
  • jdk-7u80-linux-x64-demos.tar.gz
  • UnlimitedJCEPolicyJDK7.zip

Similarly for Java 8, following are the files required

  • jdk-8u212-linux-x64.tar.gz
  • jdk-8u212-linux-x64-demos.tar.gz
  • jce_policy-8.zip

The Java Demos and Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy files are optional. There are no demos from Java 9 upwards. Since Java 9, default JCE policy files already allow for "unlimited" cryptographic strengths.

For any other JDK, you only need to have the Java binary distribution.

Installation

The script needs to be run as root.

You need to provide the JDK distribution file (tar.gz) and the Java Installation Directory. The default value for Java installation directory is "/usr/lib/jvm"

$ sudo ./install-java.sh -h

Usage: 
install-java.sh -f <java_dist> [-p <java_dir>]

-f: The jdk tar.gz file.
-p: Java installation directory. Default: /usr/lib/jvm.
-h: Display this help and exit.

Example: Installing Oracle JDK 12

$ sudo ./install-java.sh -f ~/software/java/jdk-12.0.1_linux-x64_bin.tar.gz 
Installing: jdk-12.0.1_linux-x64_bin.tar.gz
Extracting /home/isuru/software/java/jdk-12.0.1_linux-x64_bin.tar.gz to /usr/lib/jvm
JDK is extracted to /usr/lib/jvm/jdk-12.0.1
Run update-alternatives commands? [y/N] 
Do you want to set JAVA_HOME environment variable in /home/isuru/.bashrc? [y/N]

Automate Java Installation

You can automate the Java installation script by using the yes command.

Example: Installing AdoptOpenJDK 11

yes | sudo ./install-java.sh -f ~/software/java/OpenJDK11U-jdk_x64_linux_hotspot_11.0.3_7.tar.gz

Java Mission Control

The installation script will also create a shortcut for Oracle Java Mission Control (JMC).

If the "Welcome" page is blank in JMC, try installing libwebkitgtk-3.0-0 package.

sudo apt install libwebkitgtk-3.0-0

Uninstallation

There is another script named "uninstall-java.sh" to uninstall Java.

You need to provide Java distribution directory.

$ sudo ./uninstall-java.sh -h

Usage: 
uninstall-java.sh -p <java_dist_dir>

-p: Java distribution directory.
-h: Display this help and exit.

Example: Uninstall Oracle JDK 12

sudo ./uninstall-java.sh -p /usr/lib/jvm/jdk-12.0.1/

License

Copyright (C) 2014 M. Isuru Tharanga Chrishantha Perera

Licensed under the Apache License, Version 2.0




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap