JAVA/ubuntu

来自康健生活
Kangkk​(留言 | 贡献)2020年6月10日 (三) 09:53的版本

引言

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), ...).
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
# /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
 
sudo source /etc/profile

oracle

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html