• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

question reg jar file

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 310
1
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

 
ujjawal rohra
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But if B/C represents a directory structure and not a package then what will be the command???
 
ujjawal rohra
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somebody please answer
 
ujjawal rohra
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some body answer....
I am waiting
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

 
reply
    Bookmark Topic Watch Topic
  • New Topic