Java 开发环境

Java Windows 开发环境配置

1、下载JDK

我们直接到管网下载

下载url:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2、下载文件步骤

2.1选择JDK 版本(Java SE 8u201 / Java SE 8u202)

2.2同步协议选择(Windows x64 jdk-8u201-windows-x64.exe)

2.3点击jdk-8u201-windows-x64.exe 安装

2.4 安装路径的选择

2.5 jre 安装路径的选择

2.6 JDK 环境配置

我的电脑→右键→属性→高级系统设置→环境变量

变量设置

  • 新建系统变量【JAVA_HOME】:JDK根路径:D:\mainboot\Java\jdk1.8.0_201
  • 新建系统变量【CLASSPATH】:JDK的jar架包路径:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
  • 【PATH】环境变量中追加Java环境变量: ;%JAVA_HOME%\bin

输入cmd,进入dos命令框中输入javac和java

安装成功

Java Linux 开发环境配置

1、下载JDK

我们直接到管网下载

下载url:http://www.oracle.com/technetwork/java/javase/downloads/index.html

2、下载文件步骤

2.1选择JDK 版本(Java SE 8u201 / Java SE 8u202)

2.2同步协议选择(Linux x64 jdk-8u201-linux-x64.tar.gz)

2.3选择保存

3、安装 JDK 步骤

3.1打开操作终端用命令安装

3.2创建目录

mkdir -p /mnt/mainboot/env/

3.3把下载文件移到新建目录

mv ../Downloads/jdk-8u201-linux-x64.tar.gz /mnt/mainboot/env/

3.4进入新建目录

cd /mnt/mainboot/env/

3.5解压文件

tar -zxvf jdk-8u201-linux-x64.tar.gz

3.6 设置JDK配置变量,在profile文件后面追加

vim /etc/profile

 export JAVA_HOME=/mnt/mainboot/env/jdk1.8.0_201
 export PATH=.:$JAVA_HOME/bin:$PATH
 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 

3.7 执行生效

source /etc/profile

3.8测试安装是否成功

java

Usage: 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 
    -classpath 
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D=
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:...|:]
    -enableassertions[:...|:]
                  enable assertions with specified granularity
    -da[:...|:]
    -disableassertions[:...|:]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:[=]
                  load native agent library , e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:[=]
                  load native agent library by full pathname
    -javaagent:[=]
                  load Java programming language agent, see java.lang.instrument
    -splash:
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
 

javac

 Usage: javac  
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           Specify where to find user class files and annotation processors
  -cp                  Specify where to find user class files and annotation processors
  -sourcepath          Specify where to find input source files
  -bootclasspath       Override location of bootstrap class files
  -extdirs             Override location of installed extensions
  -endorseddirs        Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor [,,...] Names of the annotation processors to run; bypasses default discovery process
  -processorpath       Specify where to find annotation processors
  -parameters                Generate metadata for reflection on method parameters
  -d              Specify where to place generated class files
  -s              Specify where to place generated source files
  -h              Specify where to place generated native header files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
  -encoding        Specify character encoding used by source files
  -source           Provide source compatibility with specified release
  -target           Generate class files for specific VM version
  -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                   Pass  directly to the runtime system
  -Werror                    Terminate compilation if warnings occur
  @                Read options and filenames from file
 

安装成功

Copyright © 2019-2019主引教程mainboot.com All Rights Reserved. 备案号: 闽ICP备13019624号-4