编程经验:windows和linux下jdk安装配置

一、Linux

#1.1、安装JDK1.4.2的时候遇到如下错误:

Do you agree to the above license terms? [yes or no]
yes
Unpacking...
tail: cannot open `+532' for reading: No such file or directory
Checksumming...
1
The download file appears to be corrupted.  Please refer
to the Troubleshooting section of the Installation
Instructions on the download page for more information.
Please do not attempt to install this archive file.

# change posix version for compatability for .bin to unpack
root@bt:/home# export _POSIX2_VERSION=199209  
root@bt:/home# ./j2sdk-1_4_2_07-linux-i586.bin   

# and then change back
root@bt:/home# export _POSIX2_VERSION=200112

#1.2、配置环境
root@bt:/home# vim /etc/profile

JAVA_HOME=/home/j2sdk1.4.2_07
PATH=$PATH:./home/j2sdk1.4.2_07/bin
CLASSPATH=:/home/j2sdk1.4.2_07/jre/lib/rt.jar
export JAVA_HOME PATH CLASSPATH

#配置完,logout 重新登陆后,如果配置成功,执行javac返回正确选项。 
#linux下编译含有package.java,不能正常运行 .class程序,需要包含#package进行编译
 
二、Windows

2.1、环境变量配置:
选择Administrator的用户变量(注:系统变量配置也行)
JAVA_HOME: D:\Program Files\Java\jdk1.6.0_21
CLASSPATH: .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\bin;
PATH: %JAVA_HOME%\bin;

配置完和linux 一样注销后,命令行执行JAVAC 成功,环境变量配置成功
2.2、在执行 Eclipse Run As Java Application报如下错误:
第一种:环境变量配置错误
[Main Instruction]
Java(TM) 2 Platform Standard Edition binary 已停止工作

[Content]
Windows 可以联机检查该问题的解决方案。

[V] 查看问题详细信息  [联机检查解决方案并关闭该程序] [关闭程序] [调试程序]

第二种: JavaAndroid程序混合编译
A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3494), pid=4176, tid=7496
#  Error: ShouldNotReachHere()
#
# JRE version: 6.0_31-b05
# Java VM: Java HotSpot(TM) Client VM (20.6-b01 mixed mode windows-x86 )
# An error report file with more information is saved as:
# D:\android源码备份\StaticChartDemo\hs_err_pid4176.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

这个错误的意思,Eclipse Run As Java Application 举棋不定,
因为这个项目里面有两种java程序 :一种是 android application;另一种是java application

所以解决的方法也很简单,把他们移出分开来就行了。
posted @ 2013-06-13 14:37  信息无障碍  阅读(386)  评论(0编辑  收藏  举报