如果我的JDK是装在D:\j2sdk1.4.2_06\处的,但是我的Welcome.class 放到了e:\java\下面
应该怎么运行呀?
D:\j2sdk1.4.2_06\bin\java  e:\java\Welcome.class 这样运行 不可以,为什么呀?下面是这个类的内容
public class Welcome
{
public static void main(String args[])
{
System.out.println("Welcome to java Programming!");
}
}

解决方案 »

  1.   

    set path=D:\j2sdk1.4.2_06\bin\java
      

  2.   

    设置JAVA_HOME 环境变量
    D:\j2sdk1.4.2_06在path 中加入%JAVA_HOME\bin;java e:\java\Welcome
      

  3.   


    set path=D:\j2sdk1.4.2_06\bin\;
      

  4.   

    1,首先在控制台下运行命令:java 如果有下面类似返回信息则表示你环境变量配置成功E:\>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
    如果没成功则重新设置 环境变量2,在e:\java\目录运行 java  Welcome
      

  5.   

    "开始"---->"运行(R)..."输入"cmd"打开命令行窗口,
    在提示符下输入:set path=D:\j2sdk1.4.2_06\bin
    这样就可以在任何目录下编译java文件了
      

  6.   

    在path 中加入%JAVA_HOME\bin;java e:\java\Welcome
      

  7.   

    class path 是不用设置也可以使用的吧
    @.@||~
      

  8.   

    设置环境环境变量
    JAVA_home
    classpath
    path
      

  9.   

    设好classpath,记得要有.
    class文件的后缀不要打