Win a copy of Modern frontends with htmx this week in the Spring 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
  • 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

Jar within a Jar

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been working with some Jar file inception and I cannot find the answer to my problem. I think I am close, but I am missing a step. Right now, I want to place all of my library files (external jars) inside of my main jar for my program to use. Making one big happy jar to contain others and some compiled code. My plan of attack is to use a ClassLoader. My class loader looks like this:


Now, my problem is, I am trying to create a new instance of the Class OggClip and turn it into an Object so I can use it's methods. Like:
Java Code:

As if it were a class file in my directory.
But I cannot figure out how to get to this point. I have loaded the class using loader.loadClass(); but this is where I cannot go any further.

If anyone could help, I would appreciate it. Also, if there is a simpler way of doing this, please tell me.

Cross posted on http://www.java-forums.org/advanced-java/63219-jar-within-jar.html
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Also, if there is a simpler way of doing this, please tell me.


You could google for a solution someone else has already posted ie http://qdolan.blogspot.co.uk/2008/10/embedded-jar-classloader-in-under-100.html
 
Tony Docherty
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also I believe Eclipse and/or NetBeans provides a means of doing this.
 
Khalil Estell
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your assistance. I will try out those programs. I am having a hard time implementing them in my code though.
 
reply
    Bookmark Topic Watch Topic
  • New Topic