找回密码
 注册
搜索
查看: 1542|回复: 0

Java开发工具箱-JDK的安装与配置

[复制链接]

455

主题

49

回帖

2204

积分

管理员

积分
2204
发表于 2018-11-29 14:48:48 | 显示全部楼层 |阅读模式
Java开发工具箱-JDK的安装与配置
一、JDK、JRE

术语名缩写解释
Java Development KitJDKJava程序员用的工具包
Java Runtime EnviromentJREJava程序的运行环境
二、下载、安装JDK
    百度网盘下载链接(64位):http://pan.baidu.com/s/1bLnANG
    百度网盘下载链接(32位):http://pan.baidu.com/s/1skLzcHB
   
鼠标左键双击运行.exe,将会弹出引导程序安装JDK和JRE,
点击next,继续安装
点击change..选择你安装的路径,然后点击next
等待一会儿,会弹出安装jre的向导
可以选择安装路径,点击change选择安装路径,然后点击next
点击next steps去查看官网文档API等,点击close完成安装

三、环境变量配置
     安装完成,cd到你的安装路径下
     安装路径如下图:
   
      那两个文件夹分别是JDK和JRE的安装位置,cd到JDK\bin中执行Java命令

[url=][/url]
F:\Java\JDK\bin>dir Volume in drive F has no label. Volume Serial Number is 692A-C80C Directory of F:\Java\JDK\bin2017/01/14  12:04    <DIR>          .2017/01/14  12:04    <DIR>          ..2017/01/14  12:04            15,904 appletviewer.exe2017/01/14  12:04            16,416 extcheck.exe2017/01/14  12:04            16,416 idlj.exe2017/01/14  12:04            34,336 jabswitch.exe2017/01/14  12:04            15,904 jar.exe2017/01/14  12:04            16,416 jarsigner.exe2017/01/14  12:04            15,904 java-rmi.exe2017/01/14  12:04           206,880 java.exe2017/01/14  12:04            15,904 javac.exe2017/01/14  12:04            16,416 javadoc.exe2017/01/14  12:04           133,664 javafxpackager.exe2017/01/14  12:04            15,904 javah.exe2017/01/14  12:04            15,904 javap.exe2017/01/14  12:04           133,664 javapackager.exe2017/01/14  12:04           206,880 javaw.exe2017/01/14  12:04           318,496 javaws.exe2017/01/14  12:04            15,904 jcmd.exe2017/01/14  12:04            16,928 jconsole.exe2017/01/14  12:04            16,416 jdb.exe2017/01/14  12:04            15,904 jdeps.exe2017/01/14  12:04            15,904 jhat.exe2017/01/14  12:04            16,416 jinfo.exe2017/01/14  12:04            15,904 jjs.exe2017/01/14  12:04           174,624 jli.dll2017/01/14  12:04            16,416 jmap.exe2017/01/14  12:04           321,568 jmc.exe2017/01/14  12:04               417 jmc.ini2017/01/14  12:04            15,904 jps.exe2017/01/14  12:04            16,416 jrunscript.exe2017/01/14  12:04            16,416 jsadebugd.exe2017/01/14  12:04            16,416 jstack.exe2017/01/14  12:04            15,904 jstat.exe2017/01/14  12:04            15,904 jstatd.exe2017/01/14  12:04           196,640 jvisualvm.exe2017/01/14  12:04            16,416 keytool.exe2017/01/14  12:04            16,416 kinit.exe2017/01/14  12:04            16,416 klist.exe2017/01/14  12:04            16,416 ktab.exe2017/01/14  12:04           829,264 msvcr100.dll2017/01/14  12:04            16,416 native2ascii.exe2017/01/14  12:04            16,416 orbd.exe2017/01/14  12:04            16,416 pack200.exe2017/01/14  12:04            16,416 policytool.exe2017/01/14  12:04            15,904 rmic.exe2017/01/14  12:04            15,904 rmid.exe2017/01/14  12:04            16,416 rmiregistry.exe2017/01/14  12:04            16,416 schemagen.exe2017/01/14  12:04            16,416 serialver.exe2017/01/14  12:04            16,416 servertool.exe2017/01/14  12:04            16,416 tnameserv.exe2017/01/14  12:04           197,152 unpack200.exe2017/01/14  12:04            15,904 wsgen.exe2017/01/14  12:04            16,416 wsimport.exe2017/01/14  12:04            16,416 xjc.exe              54 File(s)      3,435,377 bytes               2 Dir(s)  51,645,952,000 bytes freeF:\Java\JDK\bin>java -versionjava version "1.8.0_111"Java(TM) SE Runtime Environment (build 1.8.0_111-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)F:\Java\JDK\bin>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  -parameters                Generate metadata for reflection on method parameters  -d <directory>             Specify where to place generated class files  -s <directory>             Specify where to place generated source files  -h <directory>             Specify where to place generated native header 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[url=][/url]

      这样做比较麻烦,没次要用的时候,都需要到这个安装位置下来 我们需要添加安装的bin目录到系统环境变量中,
复制路径后,在系统环境变量中找到path,然后添加进去
之前安装的路径的JDK的bin路径就添加到系统环境变量中啦 F:\Java\JDK\bin
在cmd下验证一下,任意路径

[url=][/url]
C:\Windows\system32>java -versionjava version "1.8.0_111"Java(TM) SE Runtime Environment (build 1.8.0_111-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)C:\Windows\system32>E:E:\>java -versionjava version "1.8.0_111"Java(TM) SE Runtime Environment (build 1.8.0_111-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)E:\>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  -parameters                Generate metadata for reflection on method parameters  -d <directory>             Specify where to place generated class files  -s <directory>             Specify where to place generated source files  -h <directory>             Specify where to place generated native header 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  -profile <profile>         Check that API used is available in the specified profile  -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 system  -Werror                    Terminate compilation if warnings occur  @<filename>                Read options and filenames from file[url=][/url]


四、编写hello world程序运行一下, 创建文件HelloWorld.java, 文件名字与类名对应,文件类型.java
public class HelloWorld{    public static void main(String[] args)    {         System.out.println("Hello World");    }}
cd到helloworld.java路径下

[url=][/url]
E:\Java>dir Volume in drive E has no label. Volume Serial Number is 35EE-5207 Directory of E:\Java2017/01/14  12:49    <DIR>          .2017/01/14  12:49    <DIR>          ..2017/01/14  12:49               130 HelloWorld.java2016/07/12  09:18    <DIR>          httpcomponents-client-4.5.22016/07/12  09:17         3,047,752 httpcomponents-client-4.5.2-bin.zip2016/07/12  08:59         1,643,553 httpcomponents-client-4.5.2-src.zip2015/12/14  08:35    <DIR>          sqljdbc_4.2               3 File(s)      4,691,435 bytes               4 Dir(s)  40,363,429,888 bytes freeE:\Java>javac HelloWorlderror: Class names, 'HelloWorld', are only accepted if annotation processing is explicitly requested1 errorE:\Java>javac HelloWorld.javaE:\Java>java HelloWorldHello World[url=][/url]





回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

党灏宇
党灏浛

QQ|手机版|daweida.com

GMT+8, 2024-4-30 23:43 , Processed in 0.185008 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表

Warning: PHP Startup: Unable to load dynamic library 'fileinfo.so' (tried: /usr/local/zend/php7.4/include/php/ext/fileinfo.so (/usr/local/zend/php7.4/include/php/ext/fileinfo.so: cannot open shared object file: No such file or directory), /usr/local/zend/php7.4/include/php/ext/fileinfo.so.so (/usr/local/zend/php7.4/include/php/ext/fileinfo.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0