去买本CSDN的JAVA专集上面有对PACKAGE机制的详细讲解。

解决方案 »

  1.   

    在classpath里加一个“.;”表示当前目录,或者在e:\jdk1.3\zhang下运行java
      

  2.   

    方法1:
    set classpath=%classpath%;e:\jdk1.3\zhang;.;(如果前面的classpath没有设置当前目录)
    e:\jdk1.3\zhang> java wei.server
    就可以了方法2:
    e:\jdk1.3\zhang> java -classpath %classpath%;e:\jdk1.3\zhang wei.server
      

  3.   

    诸位再看这道题:(等下一块给分)
    4.you have just creatd a few classes in a source file called Server.java. There is a main class called Server,whick begins the program. The top of this file has the line:
         package com.syngress;
    The classpath environment setting is properly set so it will look in c:\Java Packages for packages ,and there is a subdirectory structure of c:\Java Packages\com\syngress\Server.
    Which of the following procedures will work?
    A. You place the classes in the directory Server,and type the following:
       c:\java Packages\com\syngress\Server>java Server
    B. You place the classes in the directory syngress,and type the following:
       c:\Java Packages\com\syngress\Server>java com.syngress.Server
    C. You place the classes in the directory syngress,and type the following:
       c:\Java Packages\com\syngress>java Server
    D. You place the classes in the directory Server,and type the following:
       c:> java com.syngress.Server
    E.  None of the above
      

  4.   

    e:\jdk1.3\zhang> java wei.server
    注意目录
      

  5.   

    只有B是正确的,本题只和CLASSPATH有关,在题目中package com.syngress;就决定了只能把Server.class方到c:\Java Packages\com\syngress\下,然后使用java com.syngress.Server命令即可,至于java com.syngress.Server再什么路径下问题都不大,只要设定了path即可。比如在D中,只要将Server路径该为syngress如下:
    You place the classes in the directory syngress,and type the following:
    c:> java com.syngress.Server
    亦可正确运行。
      

  6.   

    怎么说呢,在java的编译机制中,在同一目录下的类都默认为是在同一个包中,子目录名即为包名,也即“wei”即为包名,如果在"wei"下在建一个子目录“wei",即可运行。当然,回到上一层目录运行也可以。