jdk与tomcat环境变量配置

本文详细介绍了如何在本地计算机上配置JDK和Tomcat,并通过命令行测试环境是否正确设置,确保了Java开发环境的可用性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.配置JDK

需要在"http://www.oracle.com/technetwork/java/javase/downloads/index.html" 下载JDK,然后安装在自定义文件夹下面,此处安装在“C:\MYOWN_THINGS\software_install\jdk1.7”,安装好JDK后,再配置JDK的环境变量:

我的电脑上点右键—>“属性”—>“高级”—> “环境变量(N)”

新建系统变量JAVA_HOMEC:\MYOWN_THINGS\software_install\jdk1.7

新建系统变量CLASSPATH.;%JAVA_HOME%/lib;(注意:点号表示当前目录,不能省略)

在系统变量Path的值的前面加入以下内容:%JAVA_HOME%/bin;(注意:这里的分号不能省略)

2.配置Tomcat

"http://tomcat.apache.org/"下载好tomcat,此处用的是apache-tomcat-7.0.11-windows-x86.zip,这个版本也是免安装的,直接解压到自定义目录就可以了,此处用的是"C:\MYOWN_THINGS\software_install\apache-tomcat-7.0.11",安装好Tomcat后,再配置Tomcat的环境变量:

我的电脑上点右键—>“属性”—>“高级”—> “环境变量(N)”

新建系统变量CATALINA_HOMEC:\MYOWN_THINGS\software_install\apache-tomcat-7.0.11

在系统变量CLASSPATH的值的后面加入:%CATALINA_HOME%/lib;

在系统变量Path的值中"%JAVA_HOME%/bin;"的后面加入以下内容:%CATALINA_HOME%/bin;

3.测试JDK

打开cmd进行测试JDK是否配置成功:

分别输入java与javac,现在出下面的东西则配置成功,有的人输入javac之后现在的是中文版的,这个是正常的哈。

C:\Documents and Settings\Administrator>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
    -client       to select the "client" VM
    -server       to select the "server" VM
    -hotspot      is a synonym for the "client" VM  [deprecated]
                  The default VM is client.

    -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 | -no-jre-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 with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -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 image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m
ore details.

C:\Documents and Settings\Administrator>javac
Usage: 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 u
sed
  -classpath <path>          Specify where to find user class files and annotati
on processors
  -cp <path>                 Specify where to find user class files and annotati
on 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 compil
ation 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 system
  -Werror                    Terminate compilation if warnings occur
  @<filename>                Read options and filenames from file

4.测试Tomcat

双击bin/startup.dat成功后,在浏览器中输入http://localhost:8080,如果出现tomcat的欢迎页面,则配置成功。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值