配置好了环境变量??? 貌似没配置好吧?配置好了就不会出现“.java时出现无效的标志”!
重点是 classpath 的路径 .;D:\Program Files\Java\jre1.6.0\lib;
在dos目录 输入 java 出现很多命令 才是环境变量配置好了!
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:
-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 | -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
或者dos下输入 java -version 出现
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
才是环境变量配置好了!
追问运行cmd输入java回车后出现您所给C:\Documents and Settings\Administrator>java后面的内容。但是java-version后就显示不是内部命令或外部命令,也不是可运行程序或批处理文件。但是,我先前是这样设置的:
path=F:\Program Files\Java\jdk1.6.0_23\bin;
classpath=F:\Program Files\Java\jdk1.6.0_23\lib\tools.jar;
而且cmd中运行成功了java程序。