请问一下 ,JDK安装好以后,我是XP 的系统,还需要做一些其他的设置吗,比如说 系统变量什么的,怎么设置,为什么,我在DOS 下输入 :
Javac 提示:
C:\>javac
'javac' 不是内部或外部命令,也不是可运行的程序
或批处理文件。输入:Java
C:\>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 -splash:<imagepath>
show splash screen with specified image会跳出这些。 是我没装好,还是怎么了。然后,我写好了一个Java程序,我要把这个程序放大什么位置运行它呢,是不是在电脑的任何位置呢,还会死,一定要放在能运行Java程序的,目录里才能运行呢,请问,那个能运行 Java 的 目录 路径 是什么呢
Javac 提示:
C:\>javac
'javac' 不是内部或外部命令,也不是可运行的程序
或批处理文件。输入:Java
C:\>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 -splash:<imagepath>
show splash screen with specified image会跳出这些。 是我没装好,还是怎么了。然后,我写好了一个Java程序,我要把这个程序放大什么位置运行它呢,是不是在电脑的任何位置呢,还会死,一定要放在能运行Java程序的,目录里才能运行呢,请问,那个能运行 Java 的 目录 路径 是什么呢
Java 是用来运行 *.class 文件
如: javac test.java
Java test
我的电脑-> 右击属性 ->高级 ->环境变量 ->(有用户变量和系统变量)
用户变量要设置一下 你*.java 所在的文件路径 在用户变量里面新建
变量名 classpath
变量值 如:d:\JOOP(是存放*.java的地方)
系统变量 是设置你jdk所安装的路径 如:C:\Program Files\Java\jdk1.6.0_02\bin; 这是我安装的路径 把你的路径复制加到 系统变量的PATH里面
就可以了
你也可以在你*.java 的文件所在的目录里面建个记事本 写
javac Test.java // Test看你的文件名字而定
java Test
pause
存储问bat文件 以后双击就可以了
我的电脑属性-高级-环境变量-系统变量位置 找path 这个变量点编辑 然后把java的安装路径 如:C:\Program Files\Java\jdk1.6.0_02\bin(根据你自己的实际情况)加进去 注意要在加之前输入一个分号。完成后点确定。
再点击新建按钮 在名称位置输入classpath 然后在变量值位置输入一个点 . 然后确定 JDK就可以用了
这些是基础的东西,如果想要学习java 最好有本适合的书。