Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

question reg jar file

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Somebody please answer
 
ujjawal rohra
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • 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
  • 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?

 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic