Test your knowledge of CLASSPATH issues. If you don't understand the reason for an answer, contact your teaching fellow for an explanation.
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
Command:
c:\> java -classpath c:\dev\cscie160\hw1 cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
Command:
c:\> java -classpath c:\dev cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
Command:
c:\dev> java -classpath . cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev\cscie160\hw1
hw1.jar
Contents of jar file:
C:\dev\cscie160\hw1>jar tfv hw1.jar
0 Thu Feb 08 09:18:32 EST 2006 META-INF/
72 Thu Feb 08 09:18:32 EST 2006 META-INF/MANIFEST.MF
564 Thu Feb 08 09:05:02 EST 2006 hw1/Elevator.java
150 Thu Feb 08 08:50:00 EST 2006 hw1/Elevator.class
Command:
c:\> java -classpath C:\dev\cscie160\hw1.jar cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev\cscie160\hw1
hw1.jar
Contents of jar file:
C:\dev\cscie160\hw1>jar tfv hw1.jar
0 Thu Feb 08 09:18:32 EST 2006 META-INF/
72 Thu Feb 08 09:18:32 EST 2006 META-INF/MANIFEST.MF
564 Thu Feb 08 09:05:02 EST 2006 c:/dev/cscie160/hw1/Elevator.java
150 Thu Feb 08 08:50:00 EST 2006 c:/dev/cscie160/hw1/Elevator.class
Command:
c:\> java -classpath C:\dev\cscie160\hw1.jar cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev\cscie160\hw1
hw1.jar
Contents of jar file:
C:\dev\cscie160\hw1>jar tfv hw1.jar
0 Thu Feb 08 09:18:32 EST 2006 META-INF/
72 Thu Feb 08 09:18:32 EST 2006 META-INF/MANIFEST.MF
564 Thu Feb 08 09:05:02 EST 2006 cscie160/hw1/Elevator.java
150 Thu Feb 08 08:50:00 EST 2006 cscie160/hw1/Elevator.class
Command:
c:\> java -classpath C:\dev\cscie160\hw1.jar cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev\cscie160\hw1
hw1.jar
Contents of jar file:
C:\dev\cscie160\hw1>jar tfv hw1.jar
0 Thu Feb 08 09:18:32 EST 2006 META-INF/
72 Thu Feb 08 09:18:32 EST 2006 META-INF/MANIFEST.MF
564 Thu Feb 08 09:05:02 EST 2006 cscie160/hw1/Elevator.java
150 Thu Feb 08 08:50:00 EST 2006 cscie160/hw1/Elevator.class
Command:
c:\> java -classpath C:\dev\cscie160\hw1\hw1.jar cscie160.hw1.Elevator
What happens when this command is executed?
Contents of directory c:\dev
HelloWorld.class (no package)
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
HelloWorld.class (no package)
Command:
c:\> java -classpath C:\dev cscie160.hw1.HelloWorld
What happens when this command is executed?
Contents of directory c:\dev
HelloWorld.class (no package)
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
HelloWorld.class (no package)
Command:
java -classpath C:\dev\cscie160\hw1 HelloWorld
What happens when this command is executed?
Contents of directory c:\dev
HelloWorld.class (no package)
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
HelloWorld.class (no package)
Command:
c:\dev> java -classpath . HelloWorld
What happens when this command is executed?
Contents of directory c:\dev
HelloWorld.class (no package)
Contents of directory c:\dev\cscie160\hw1
Elevator.class (package cscie160.hw1;)
HelloWorld.class (no package)
Command:
c:\dev> java -classpath . cscie160.hw1.Elevator
What happens when this command is executed?