| Author |
question reg jar file
|
ujjawal rohra
Ranch Hand
Joined: Mar 20, 2010
Posts: 101
|
|
Suppose ther is a file A.java which needs access to a file D.java located in file myjar.jar.
The directory structure in myjar.jar is B/C/D.java.
Then when using classpath i will have to state only the name of jar file or will i have to specify the directory structure also ??
such as myjar.jar/B/C
|
SCJP 6
|
 |
Rajeev Rnair
Ranch Hand
Joined: Mar 22, 2010
Posts: 308
|
|
ujjawal rohra wrote:Suppose ther is a file A.java which needs access to a file D.java located in file myjar.jar.
The directory structure in myjar.jar is B/C/D.java.
Then when using classpath i will have to state only the name of jar file or will i have to specify the directory structure also ??
such as myjar.jar/B/C

I believe the file D.java is in a "package B.C"
and you do "import B.C.D" in "A.java"
Assuming current dir is having myjar.jar and A.java
you have to use
|
SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
|
 |
ujjawal rohra
Ranch Hand
Joined: Mar 20, 2010
Posts: 101
|
|
|
But if B/C represents a directory structure and not a package then what will be the command???
|
 |
ujjawal rohra
Ranch Hand
Joined: Mar 20, 2010
Posts: 101
|
|
|
Somebody please answer
|
 |
ujjawal rohra
Ranch Hand
Joined: Mar 20, 2010
Posts: 101
|
|
Some body answer....
I am waiting
|
 |
Rajeev Rnair
Ranch Hand
Joined: Mar 22, 2010
Posts: 308
|
|
ujjawal rohra wrote:Suppose ther is a file A.java which needs access to a file D.java located in file myjar.jar.
The directory structure in myjar.jar is B/C/D.java.
Then when using classpath i will have to state only the name of jar file or will i have to specify the directory structure also ??
such as myjar.jar/B/C

Couple of things here:
1. For your A.java to run, you should have "D.class" in your jar "myjar.jar" (B/C/D.class)
2. Why is this particular requirement of putting D.class in B/C/D.class directory structure in "myjar.jar". Why can't you just create a jar "myjar.jar" and put "D.class" there?
3. Have you tried this yourself?
|
 |
 |
|
|
subject: question reg jar file
|
|
|