安装java环境
时间:2007-11-22 来源:JustDoIt_Randolph
1.从Internet下载jdk
2.安装步骤
- Make the shell script executable
% chmod +x j2sdk-1.4.2-03-linux-<ARCH>.bin
(Replace <ARCH> with the architecture of your system, e.g.
replace <ARCH> with i586 if your on an Intel system.)
- Change to the directory you want to install into, e.g /usr/local
% cd /usr/local
- Extract the contents of the Java 2 SDK by running the shell script
% ./j2sdk-1.4.2-03-linux-<ARCH>.bin
(Replace <ARCH> with the architecture of your system, e.g.
replace <ARCH> with i586 if your on an Intel system.)
3.环境配置
- Add j2sdk1.4.2/bin to PATH, e.g. if you installed into /usr/local
编辑/etc/profile 文件----对所有用户有效 ,添加
export JAVA_HOME=/usr/local/j2sdk1.4.2
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
4. 测试
写一个HelloWorld.java
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("hello world in linux");
}
}
javac HelloWorld.java
java HelloWorld
如果输出hello world in linux,表示成功安装java
2.安装步骤
- Make the shell script executable
% chmod +x j2sdk-1.4.2-03-linux-<ARCH>.bin
(Replace <ARCH> with the architecture of your system, e.g.
replace <ARCH> with i586 if your on an Intel system.)
- Change to the directory you want to install into, e.g /usr/local
% cd /usr/local
- Extract the contents of the Java 2 SDK by running the shell script
% ./j2sdk-1.4.2-03-linux-<ARCH>.bin
(Replace <ARCH> with the architecture of your system, e.g.
replace <ARCH> with i586 if your on an Intel system.)
3.环境配置
- Add j2sdk1.4.2/bin to PATH, e.g. if you installed into /usr/local
编辑/etc/profile 文件----对所有用户有效 ,添加
export JAVA_HOME=/usr/local/j2sdk1.4.2
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
4. 测试
写一个HelloWorld.java
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("hello world in linux");
}
}
javac HelloWorld.java
java HelloWorld
如果输出hello world in linux,表示成功安装java
相关阅读 更多 +