Linux系统下JDK安装,Java环境变量配置
来源:互联网 发布:java求质数的方法 编辑:程序博客网 时间:2024/05/21 12:46
Linux系统安装JDK
1、准备JDK安装文件,同样可以在Sun官网进行下载,下载前选择好相应的系统版本,可以下载bin文件也可以下载rpm包文件。我这里安装 "jdk-1_6_0_17-linux-i586.bin" 此版本。
2、登陆Linux服务器(建议使用root用户,可使用SSH工具操作Linux,SSH工具的File Transfer上传文件),上传文件至服务器目录,如:"/home/appuser/"。
3、将文件复制到需要安装的目录之下。命令:
cp /home/appuser/jdk-1_6_0_17-linux-i586.bin /usr/local/jdk-1_6_0_17-linux-i586.bin
4、到JDK所在目录(cd /usr/local/),赋予 jdk-1_6_0_17-linux-i586.bin 文件可执行权限。命令:
chmod 777 jdk-1_6_0_17-linux-i586.bin
5、执行文件,安装JDK。命令:
./jdk-1_6_0_17-linux-i586.bin
6、同意Sun协议,完成安装,会生成目录 "jdk1.6.0_17"。若没有错误,到此则JDK安装完成。可以使用命令(mv jdk1.6.0_17 jdk)将该目录名更改为你需要的,例如 "jdk"。
四、Linux系统Java环境变量配置
1、/etc/profile 文件就是Linux系统配置文件,为保险起见,先备份系统配置文件(cp /etc/profile /etc/profile-bak)。
2、进入/etc/目录(cd /etc/)使用vi工具编辑profile文件(使用 vi profile 命令进入编辑器命令模式,输入"i"开始插入内容,将光标移动至目标位置,输入完毕之后按Esc退出编辑模式回到命令模式,命令模式下输入":wq!"保存退出),在末尾输入如下内容(Linux系统中的分隔符为":"):
export JAVA_HOME=/usr/local/jdk export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin
3、保存完毕之后使配置生效,命令:
source /etc/profile
4、验证版本
appuser@usm:~> java -versionjava version "1.6.0_17"Java(TM) SE Runtime Environment (build 1.6.0_17-b04)Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)appuser@usm:~>
appuser@usm:~> javaUsage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file)where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM The default VM is server. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A : separated list of directories, JAR archives, and ZIP archives to search for class files. -D<name>=<value> set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -version:<value> require the specified version to run -showversion print product version and continue -jre-restrict-search | -jre-no-restrict-search include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] enable assertions -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] disable assertions -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:<libname>[=<options>] load native agent library <libname>, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<options>] load native agent library by full pathname -javaagent:<jarpath>[=<options>] load Java programming language agent, see java.lang.instrument -splash:<imagepath> show splash screen with specified imageappuser@usm:~>
appuser@usm:~> javacUsage: javac <options> <source files>where possible options include: -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info -nowarn Generate no warnings -verbose Output messages about what the compiler is doing -deprecation Output source locations where deprecated APIs are used -classpath <path> Specify where to find user class files and annotation processors -cp <path> Specify where to find user class files and annotation processors -sourcepath <path> Specify where to find input source files -bootclasspath <path> Override location of bootstrap class files -extdirs <dirs> Override location of installed extensions -endorseddirs <dirs> Override location of endorsed standards path -proc:{none,only} Control whether annotation processing and/or compilation is done. -processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process -processorpath <path> Specify where to find annotation processors -d <directory> Specify where to place generated class files -s <directory> Specify where to place generated source files -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files -encoding <encoding> Specify character encoding used by source files -source <release> Provide source compatibility with specified release -target <release> Generate class files for specific VM version -version Version information -help Print a synopsis of standard options -Akey[=value] Options to pass to annotation processors -X Print a synopsis of nonstandard options -J<flag> Pass <flag> directly to the runtime systemappuser@usm:~>
至此Linux系统下JDK安装,Java环境变量配置全部完成。
- Linux系统下JDK安装,Java环境变量配置
- Linux系统下JDK的安装与环境变量的配置
- linux系统下JDK的安装与环境变量的配置
- Java mac系统下JDK安装和环境变量的配置
- Windows、Linux系统安装JDK配置Java环境变量
- Linux下安装JDK并配置Java环境变量
- linux下安装java jdk及环境变量配置
- Linux 系统下jdk环境变量配置
- linux系统安装jdk并配置环境变量
- linux系统下安装jdk环境变量
- Linux下安装JDK及其配置环境变量
- linux下安装jdk及配置环境变量
- Linux下安装JDK并配置环境变量
- linux 下安装JDK及配置环境变量
- Linux下安装Jdk,配置环境变量详细
- Linux下安装jdk+tomcat 配置环境变量
- Linux下jdk安装、环境变量的配置
- linux 下安装JDK和配置环境变量
- 【问题汇总】IntentService报空指针异常的问题
- HTTP协议简明介绍
- 如何建立英文字符的哈希表
- 电子商务系统
- apn与spn攻略
- Linux系统下JDK安装,Java环境变量配置
- "长按实现视图抖动和删除"功能知识点整理
- linux C gbk utf-8编码转换
- C#(同步调用、异步调用、异步回调)
- NSString compare方法详解
- C++编程技巧
- Java开发中的23种设计模式详解(转)
- mysql SHOW STATUS 详解
- JavaScrpit事件处理程序