Given the following directory structure:
If the current directory is
test, and you create a .jar file by invoking this,
jar -cf MyJar.jar myApp
then which path names will find a file in the .jar file? (Choose all that apply.)
A. Foo.java
B. Test.java
C. myApp/Foo.java
D. myApp/Bar.java
E. META-INF/Foo.java
F. META-INF/myApp/Foo.java
G. myApp/myAppSub/Bar.java
Answer:
C and G are correct. The files in a .jar file will exist within the same exact
structure in which they existed when the .jar was created. Although a .
a META-INF directory, none of your files will be in it. Finally, if any files
directory from which the jar command was invoked, they won’t be included
.jar file by default.
A, B, D, E, and F are incorrect based on the above. (Objective 7.5)
Hi everyone
I am studying chapter 10 of K&B
SCJP studyguide and am struggling to understand the outcomes of the above code in question 10, selftest questions, a.jar file was created and they are asking which pathnames will find the file in the .jar file?
I suppose the jar command create a JAR file called MyJar.jar and it contain myApp diretory and myApp's entire subdirectory tree and files. If C is correct why D is incorrect and also i would like to understand why G is correct. Thanks in advance.