• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JavaBeans sharing two or more utility classes.

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two java beans which can act independently of each other and are stored in A.jar and B.jar Each bean makes use of a simple utility class called C.class
For the beans to work independently of each other I am storing C.class in both the A.jar and B.jar files. However if I wish to create a new class file that uses both beans A.jar and B.jar the compiler complains in that it doesn't know which copy of C.class to use, that stored in A.jar or in B.jar
I could easily package up C.class into another jar file called C.jar and ship that with the beans A.jar and B.jar. Given that C.class is a simply utility class that would never be used independently of A.jar and B.jar I was hoping there was a better way to do this. Any ideas would be greatly appreciated.

------------------
JFind - Your Java Software Resource www.jfind.com
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put C.class in its own c.jar, and let a.jar and b.jar refer to this jar (the Class-Path attribute in the Manifest file; see "docs/guide/jar/jar.html#JAR Manifest" in your JDK directory).
- Peter
 
Van Glass
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,
Thanks for the hint. That did the trick.
 
reply
    Bookmark Topic Watch Topic
  • New Topic