jdk java
- linux
- windows
- ubuntu 12.04
linux 平台:
官方地下载:java7
~/.profile
JAVA_HOME=/opt/jdk1.7.0_51
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
source ~/.profile
windows平台:
1.建系统变量 JAVA_HOME D:\Java\jdk1.7.0(依照环境,我的jdk安装在D:\Java\jdk1.7.0 jre7安装在D:\Java\jre7)
2.建系统变量 CLASSPATH %JAVA_HOME%\lib; (一定要注意;号,否则会报错HelloWorld找不到主类)
3.修改系统变量path 末尾加上 ;%JAVA_HOME%\bin 不在乎大小写
检验 cmd指令
echo %java_home%
echo %classpath%
echo %path%
java -version
helloworld:
/*HelloWorld.java*/
public class HelloWorld{
public static void main(String arg[]) {
System.out.println("Hello, World!");
}
}
javac HelloWorld.java
java HelloWorld
*********output*********
Hello, World!
原文:http://thedaneshproject.com/posts/how-to-install-java-7-on-ubuntu-12-04-lts/
1. Add the “WEBUPD8″ PPA.
danesh@python:~$sudo add-apt-repository ppa:webupd8team/java
2. Update your repositories.
danesh@python:~$sudo apt-get update
3. Install JAVA 7 JDK.
danesh@python:~$sudo apt-get install oracle-java7-installer
To uninstall,
sudo apt-get remove oracle-java7-installer