Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

question reg jar file

 
Ranch Hand
Posts: 105
  • 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: 105
  • 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: 105
  • 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: 105
  • 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?

 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic