software-installation – 如何在不拖动无关的GUI和声音包的情况下在Ubuntu 12.04上安装openjdk-7-jdk?

Ubuntu 12.04.2 LTS

这里发生了什么?

# apt-get install openjdk-7-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  consolekit cryptsetup-bin dbus-x11 dconf-gsettings-backend dconf-service
  gconf-service gconf-service-backend gconf2 gconf2-common gvfs gvfs-common
  gvfs-daemons gvfs-libs libatasmart4 libavahi-glib1 libbonobo2-0
  libbonobo2-common libcairo-gobject2 libcanberra0 libck-connector0
  libcryptsetup4 libdconf0 libfontenc1 libgconf-2-4 libgconf2-4 libgdu0
  libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgnome-keyring-common
  libgnome-keyring0 libgnome2-0 libgnome2-bin libgnome2-common libgnomevfs2-0
  libgnomevfs2-common libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0
  libidl-common libidl0 libllvm3.0 libltdl7 liblvm2app2.2 liborbit2
  libpam-ck-connector libpolkit-agent-1-0 libpolkit-backend-1-0 libsgutils2-2
  libtdb1 libvorbisfile3 libx11-xcb1 libxaw7 libxcb-glx0 libxcb-shape0 libxmu6
  libxpm4 libxv1 libxxf86dga1 libxxf86vm1 mtools openjdk-7-jre policykit-1
  policykit-1-gnome sound-theme-freedesktop udisks x11-utils

是否可以在没有Gnome和X11一半的情况下安装JDK?和声音主题?这是一个无头(无扬声器)服务器.

解决方法:

更新

我个人试图避免使用Java,因为在我看来它非常笨拙.
这些说明是从各种来源拼凑而成的,
我最近必须安装Java,这应该适合你.

如果您的许可要求允许,请安装Oracle Java.
here下载java,你需要根据你安装的内容选择你需要的那个.

JDK x64

wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz

JDK x32

wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz

JRE x64

wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jre-7u51-linux-x64.tar.gz

JRE x32

wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jre-7u51-linux-i586.tar.gz

请注意,您需要一个wget和oracle一起使用的解决方法.

创建Java所在的目录:

sudo mkdir -p /usr/lib/jvm

移动下载的Java:

sudo mv jdk-7u51-linux-x64.tar.gz /usr/lib/jvm

提取Java:

sudo tar zxvf jdk-7u51-linux-x64.tar.gz

告诉Ubuntu Java存在:

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_51/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_51/bin/java 1
sudo update-alternatives --set javac /usr/lib/jvm/jdk1.7.0_51/bin/javac
sudo update-alternatives --set java /usr/lib/jvm/jdk1.7.0_51/bin/java

将java路径添加到系统配置文件中,以便机器知道Java二进制文件的位置:

sudo nano /etc/profile

在文件的末尾添加:

JAVA_HOME=/usr/lib/jvm/jdk1.7.0_51
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export PATH

保存并重启.

测试您的Java安装:

java -version
上一篇:java更开源-安全可靠国产系统背景下的应有.NET Core的一席之地


下一篇:安卓项目编译出现javax.xml.bind.JAXBException的编译异常信息解决方法