• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jar within a Jar

 
Khalil Estell
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
Tony Docherty
Saloon Keeper
Posts: 3137
72
  • Mark post as helpful
  • send pies
  • 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
Saloon Keeper
Posts: 3137
72
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!