A UNIX user named Bob wants to replace his chess program with a
new one, but he is not sure where the old one is installed. Bob is
currently able to run a Java chess program starting from his home
directory /home/bob using the command:
java -classpath /test:home/bob/downloads/* .jar games.Chess//题目中test后是“:”,我想应该是“;”吧?对吗?
Bob’s CLASSPATH is set (at login time) to:
/usr/lib;/home/bob/classes;/opt/java/lib;opt/java/lib/* .jar;
What is a possible location for the Chess.class file?
我理解的题意如下,不知道理解对了没,谢谢
UNIX用户Bob想要把伊老的chess program换成新的,但是伊不知道老的程序安装在哪儿了。Bob最近在伊的管理员目录(问题一:his home directory翻译成管理员目录对吗?)用如下命令运行了一个Java chess program:
java -classpath /test:/home/bob/downloads/* .jar games.Chess
伊的CLASSPATH设置如下:
/usr/lib;/home/bob/classes;/opt/java/lib:/opt/java/lib/* .jar;
问Chess.class可能的安放目录是在???
A. /test/Chess.class
B. /home/bob/Chess.class
C. /test/games/Chess.class
D. /usr/lib/games/Chess.class   //问题二:如果改usr/lib/test/games/Chess.class应该就正确了,对吗?
E. /home/bob/games/Chess.class
F. inside jarfile /opt/java/lib/Games.jar (with a correct manifest)
G. inside jarfile /home/bob/downloads/Games.jar (with a correct
manifest)
Answer: C
问题三:如何正确地判断其安装目录呢?谢谢

解决方案 »

  1.   

    //题目中test后是“:”,我想应该是“;”吧?对吗? 这里用的是 UNIX,当然是用 :安装目录其实很明显,/path/to/games/Chess.class根据 classpath,可能的路径为/test/games/Chess.class/usr/lib/games/Chess.class/home/bob/classes/games/Chess.class/opt/java/lib/games/Chess.class用排除法即可
      

  2.   

    根据题目的意思,需要在命令中加 classpath 才能运行,排除 CLASSPATH 中设定的路径结果只能是
    /test/games/Chess.class