JAVA/ubuntu:修订间差异
来自康健生活
< JAVA
无编辑摘要 |
|||
| (未显示同一用户的8个中间版本) | |||
| 第1行: | 第1行: | ||
== 引言 == | == 引言 == | ||
=== javac === | === javac === | ||
{{ | {{shc_out|<syntaxhighlight lang="bash"> | ||
javac</syntaxhighlight>|<pre> | javac</syntaxhighlight>|<pre> | ||
Command 'javac' not found, but can be installed with: | Command 'javac' not found, but can be installed with: | ||
| 第11行: | 第11行: | ||
sudo apt install ecj # version 3.16.0-1 | sudo apt install ecj # version 3.16.0-1 | ||
sudo apt install openjdk-8-jdk-headless # version 8u252-b09-1ubuntu1</pre>|kangkk@kangkk:~$}} | sudo apt install openjdk-8-jdk-headless # version 8u252-b09-1ubuntu1</pre>|kangkk@kangkk:~$}} | ||
=== 环境变量 === | |||
{{shc|<syntaxhighlight lang="bash"> | |||
sudo vi /etc/profile</syntaxhighlight>|$}} | |||
{{Hcdiff|/etc/profile|<syntaxhighlight lang="javascript"> | |||
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) | |||
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). | |||
if [ "${PS1-}" ]; then | |||
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then | |||
</syntaxhighlight> | |||
|<syntaxhighlight lang="javascript"> | |||
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) | |||
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). | |||
export JAVA_HOME=/usr/lib/jvm/openjdk-14-jdk-headless | |||
export JRE_HOME=$JAVA_HOME/jre | |||
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH | |||
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH | |||
if [ "${PS1-}" ]; then | |||
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then | |||
</syntaxhighlight>}} | |||
{{shc|<syntaxhighlight lang="bash"> | |||
source /etc/profile</syntaxhighlight>|$}} | |||
== oracle == | == oracle == | ||
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html | [https://www.oracle.com/java/technologies/javase-downloads.html Java SE Downloads] 下载 JDK,或者直接去下载页面下载,如 [http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Java SE Development Kit 8 Downloads]。 | ||
{{shc|<syntaxhighlight lang="bash"> | |||
tar -zxvf jdk-8u181-linux-x64.tar.gz | |||
sudo mkdir /usr/java | |||
sudo mv ./jdk1.8.0_181 /usr/java</syntaxhighlight>|$}} | |||
=== 环境变量 === | |||
同上 | |||
2020年6月10日 (三) 10:07的最新版本
引言
javac
kangkk@kangkk:~$
javac
Command 'javac' not found, but can be installed with:
sudo apt install default-jdk # version 2:1.11-72, or sudo apt install openjdk-11-jdk-headless # version 11.0.7+10-3ubuntu1 sudo apt install openjdk-13-jdk-headless # version 13.0.3+3-1ubuntu2 sudo apt install openjdk-14-jdk-headless # version 14.0.1+7-1ubuntu1 sudo apt install ecj # version 3.16.0-1
sudo apt install openjdk-8-jdk-headless # version 8u252-b09-1ubuntu1
环境变量
sudo vi /etc/profile
/etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
export JAVA_HOME=/usr/lib/jvm/openjdk-14-jdk-headless
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
source /etc/profile
oracle
Java SE Downloads 下载 JDK,或者直接去下载页面下载,如 Java SE Development Kit 8 Downloads。
tar -zxvf jdk-8u181-linux-x64.tar.gz
sudo mkdir /usr/java
sudo mv ./jdk1.8.0_181 /usr/java
环境变量
同上
No categories