诸位再看这道题:(等下一块给分) 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
e:\jdk1.3\zhang> java wei.server 注意目录
只有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 亦可正确运行。
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
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
注意目录
You place the classes in the directory syngress,and type the following:
c:> java com.syngress.Server
亦可正确运行。