Sunday, August 29, 2010

CLASSPATH

Courtesy of Sun Web Learning Center

A programmer wants to work from a directory that contains: - A subdirectory named jarDir that contains a JAR file called MyJar.jar. - A file named Test.java that uses MyJar.jar. Which two will allow the programmer to compile the program? (Choose two.)


A Invoke javac -classpath jarDir/MyJar.jar Test.java
B Invoke javac -CLASSPATH jarDir/MyJar.jar Test.java
C Add jarDir to the CLASSPATH and invoke javac Test.java
D Add jarDir/MyJar.jar to the CLASSPATH and invoke javac Test.java

A and D are correct. These two approaches correctly match the javac command with the classpath information it needs.

No comments:

Post a Comment