classpath=
.;D:\jdk1.5.0_06\lib\tools.jar;D:\jdk1.5.0_06\lib\dt.jar
path=
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;D:\jdk1.5.0_06\bin;C:\Program Files\IDM Computer Solutions\UltraEdit-32
path里D:\jdk1.5.0_06\bin是我设置的,别的是软件安装时软件写上去的
我在e:\java\HelloWorld.java文件
我想在命令提示符下任何一目录运行javac HelloWorld.JAVA和java HelloWorld
我这样设置不行,需要如何设置?
------解决方案--------------------
当然不能在任意目录下运行了,只能在 e:\java 下运行。
------解决方案--------------------
编译必须在当前目录下进行,运行时改为
C:\> java -cp e:\java HelloWorld
就可以在其他目录里运行了。
------解决方案--------------------
没加分号!
------解决方案--------------------
在命令提示符下输入JAVA 看一下你是否配对了,显示如下:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
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
-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
C:\Documents and Settings\Administrator>
如果是,就跳转到e:\java\下
操作如下:
e:\java\javac HelloWorld.java
e:\java\java HelloWorld
------解决方案--------------------
路径是必须的吧,除非你在这个目录下编译和运行因该是直接打可以的!