Packaging third jars

Hi All
I was wondering if I could package third party jar files into the jar file generated by my application. The aim is to have one large jar file which contains other third party jar files too. Any pointers in this regard would be great. Also if this is possible how do I specify those jars in the classpath?
Thanks
Avinash

Technically you simply unzip the content and add it to your jar. There are several possible problems 'though:
* Legal: Make sure that each License involved actually allows you to do that
* META-INF: The other jar might have some information in it's META-INF and/or MANIFEST.MF, you'll have to figure out how to fix this
* Duplicate classes: if for some reason the original third party jar file and your mega-jar find themselves on the same classpath you'll have serious fun (for very un-fun definitions of "fun").
That beeing said there is a tool names jarjar (http://www.tonicsystems.com/products/jarjar/) which should help you with the last part. I've just seen (when googling for jarjar), that there is another similar tool named one-jar (http://one-jar.sourceforge.net/) which might be usefull as well. I'd suggest you try both and use what's better for you.

Similar Messages

  • Package api.jar in WebLogic 10.3

    Hi,
    in Oracle WebLogic 10.3 (windows xp release) the package api.jar in WL_HOME\wlserver_10.3\server\lib is just 1 kb and has no classes inside (just a META-INF directory).
    Is this a bug in weblogic installation because in WebLogic 10.0 the api.jar is about 1 mb and has all the servlet classes etc. inside?
    Any help would be greatly appreciated.
    Thanks in advance
    - Stephan

    You stopped too soon, open the META-INF directory and the MANIFEST.MF file to see which jar files are referenced.
    In the 8.1 world, you could use weblogic.jar for client applications and all the classes you need were in one place.
    In the 10.3 world, the server has been modularized into many different pieces. However, you can build a complete jar called the wlfullclient.jar using a tool called JarBuilder that works much like the way the 8.1 world works. Please reference the following 2 links:
    http://edocs.bea.com/wls/docs103/client/basics.html#wp1069994
    http://edocs.bea.com/wls/docs103/client/jarbuilder.html

  • How to package other jar files into one jar?

    How to package other jar files into one jar? How can i get the class in the inner jar file?

    Generally not a good idea. The Java runtime won't be able to load classes from those "inner" jars, you'd have to write your own classloader to do that. It's not a brilliant idea, generally, anyway, since the point of having lots of jars is to keep your application modular. Bundling them all together like that means you have to re-deploy the whole thing to fix, for instance, one small bug in one small library
    If you really want to do this, there's an Eclipse plugin called FatJar, but I urge you to consider whether you really want to do it first.

  • How to package third party jars into an ejb application?

    Hello everyone, thanks for reading...
    Does anybody can give me any hints or directions on how to include inside my .ear or .jar all the dependencies of all my EJBs?
    I need to deploy inside my ejb.jar or application.ear all the dependencies. The thing it's that I have a services-ejb.jar and it depends on several jars: services-api.jar, services-util.jar, ws-client.jar, etc.
    I read somewhere that these jars should be inside the META-INF/lib directory inside the ejb-jar. Is this correct?
    I deploy to Oracle Application Server and I'm using EJB 3.0.
    Thanks in advice.

    IDE and Maven have nothing to do with it.
    You need to look at your Oracle AS docs and put the 3rd party JARs in the directory where it expects to find them. I don't know where that is. Most Java EE app servers are different. WebLogic uses an APP-INF directory at the top level of the EAR file. I don't believe it's a Java EE standard. There's more variability in EAR arrangements than there is for WAR files. Those are standard.
    %

  • Packaging executable jars for my Swings based Desktop application

    I have developed a swings based desktop application for which we used third party JDIC jar inorder to incorporate the tray icon functionality for our application.
    The problem is i need to provide a distributable for this application and the application's executable jar file gets automatically created as a part of build from IDE [Am using NetBeans6.0]. The Application's exec.jar is not able to locate the jdic.jar and hence am unable to get the tray icon functionality, when i run the application's exec jar.
    i.I tried packaging the jdic lib jar with in the application's jar but got to know that tht can't solve the issue.
    ii.I also tried editing the manifest file to provide the class path to the thrid party jar [jdic] ... but of no use
    Any Help regarding this would be thoroughly appreciated.

    can anyone pls let me know how would i be able to package my application as distributable so that others can deploy and run.

  • HelpSet works but not when packaged in JAR

    I have been using the JavaHelp and it all works perfectly if I just compile and run it from Eclpise, but when I try packaging everything into a JAR it doesn't work. Can anyone help me please?
    public void loadHelpSet()
    InfoMsg.postError("loading help") ;
    try
    // Get the classloader of this class.
    ClassLoader cl = this.getClass().getClassLoader() ;
    URL url = HelpSet.findHelpSet(cl, "Irs") ;
    irsHS = new HelpSet(cl, url) ;
    HelpBroker hb = irsHS.createHelpBroker() ;
    hb.setDisplayed(true) ;
    catch (Exception e)
    InfoMsg.postError("Unable to load Help Set") ;
    } // end loadHelpSet
    it doesn't appear to get past the line irsHS = new HelpSet(cl, url) when run from the JAr, but it doesn't appear to throw an error either as no message box is shown (as it would if it couldn't find the helpset under normal circumstances when run from Eclipse)

    I tried that approach but it doesn't work either. I think maybe my directory structure is wrong.
    C:\IRS\IRS.jar
    C:\IRS\irs.hs
    referenced: jar:file://C:/IRS/IRS.jar!/irs.hs
    Am I doing this right?

  • Problem with JSP using bean packaged in jar file

    Hi,
              I am trying to use a java bean in a jsp file. The java bean is packaged
              into a jar file. I am getting class not found compilation error. If the
              bean remains to be a seperated class file, everything work well.
              Does anyone know how I can use bean in a jar file within jsp , i.e. to
              allow the bean to be found during compilation ?
              Thanks,
              Terence.
              [email protected]
              

    Jacek,
              Thanks for replying.
              My JSP's are just files in my document root . However, I found a solution to
              my
              problem. That is to have the jar file defined in my weblogic.class.path. I may
              have missed some files in my original jar file which causes my problem.
              Mayby I should package everything into a web application for deployment. That
              will be my next step.
              Thanks anyway.
              Terence.
              Jacek Laskowski wrote:
              > Terence Lai wrote:
              > >
              > > Hi,
              > >
              > > I am trying to use a java bean in a jsp file. The java bean is packaged
              > > into a jar file. I am getting class not found compilation error. If the
              > > bean remains to be a seperated class file, everything work well.
              >
              > How do you use the JSP file ? Is it a part of web application ? If so,
              > the bean jar package should be located in WEB-INF/lib directory. It's
              > also recommended to put the bean class into a package, so it's not in
              > 'unnamed' package, and <jsp:useBean> can find it.
              >
              > >
              > > Does anyone know how I can use bean in a jar file within jsp , i.e. to
              > > allow the bean to be found during compilation ?
              >
              > see above.
              >
              > > Terence.
              >
              > Jacek Laskowski
              > HP Consulting
              

  • How to use packages and jar files for applet?

    Hi!
    My applet takes a class say a.class.
    Now this class depends on other classes that are packaged
    in a directory and put separately.
    I want to put this applet on the web.
    So how do I manage the .class files in he package.
    I have tried using jar file format.But I was not able to get it working.
    Can someone please help me?
    Thanks

    Use Archive instead of codebase:
    <APPLET CODE="MyApplet.class" ARCHIVE="MyApplet.jar" WIDTH=400 HEIGHT=300></APPLET>

  • Packages in jar

    Hi, everyone i'm beginner so please help me in my issue. i'v got jar file with directorys(packages) inside:
    Chart (here i'm using jfreechart library)
    Window
    Enter.java
    so two directories and one file with main method. so in eclipse it's running good, but in command line i'cant implement this jfreechart library. without jar file i'm running
    java Enter -classpath ./jfreechart.jar ---> and it's running
    so my request is how can i run jar file with my classpath in command line
    i was trying such as: java -jar enter.jar -cp "d:\jar\lib\jcommon-1.0.9.jar" but it doesn't work:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/chart/ChartPanel
    , please help me with this,
    thanks and best regards

    If i understand what you are trying to do, you have a jar inside a jar, and hoping that the classloader can find classes in the inner jar when running the Enter class in the outer jar. Java doesn't work that way. Jar's must all be at the top level. There is a sourceforge project, one-jar http://one-jar.sourceforge.net/, that allows you to do this, but it's not a standard sun pattern.

  • Importing packages from jar file

    Hi all,
    I have a jar file that contain a package . And i set the clathpath with the path of jar file including the jar file name. And when I import the package i have an error that package does not exist. And I don't know why.

    1.) did you spell the path + name of the JAR file correctly?
    2.) Did you spell the package name including capitalization correctly?
    3.) Is the package hierarchie in the JAR the same as the package names?

  • Confused about beans, packages, and jars

    Hello,
    I've created a package that contains three public classes, Animation, Animator, and AnimatedPanel. I won't explain what they do, since it's rather irrelevant; It is important to note that AnimatedPanel extends JLabel. The package is com.buchuki.animations
    What I want to do is place the AnimatedPanel onto a JPanel, in Forte. To do this, it appears that I have to make the AnimatedPanel a bean. (or do it using extra code, but that defeats the purpose of using an IDE). I understand the basics of beans, but not much more. I've searched these forums and skimmed the Java Bean tutorial, but haven't found anything helpful. (at least, not completely helpful! ;)
    The problem is, I want to make a bean out of the class com/buchuki/animations/AnimatedPanel.class, but not out of the other two classes in that package. However, I will want to use those other two classes to interact with the AnimatedPanel class in the application I am using. (I'll import com.buchuki.animations.*;)
    From what I've read, it appears that you have to run the jar command from the parent directory of the package (ie: in animations/com/buchuki/animations, I run the jar command from animations/). But that would include all files in com, would it not? I guess I don't know what to do at all, but how do I make a bean out of AnimatedPanel and yet keep the bean as a part of the package that uses the "helper" classes? Is it a semi-advanced entry in the manifest file?
    Thanks,
    Dusty

    Ok, I've figured out a few things in my research, but it's still not working. I guess that the Java-Bean: True applies to only one package, and not to the jar archive as I first thought.
    However, I'm still a little unsure how I can include the package in the jar archive as a part of my program; is it that I should use the extension mechanism mentioned in the jar tutorial?
    And at any rate, even with a manifest file like this:
    Name: com/buchuki/animations/AnimatedPanel.class
    Java-Bean: True
    and archiving with:
    jar cfm mainfest.txt animations.jar com
    This creates the archive, but when I try to add new Java Bean in forte, it says that the archive is not a valid bean. What am I missing? Did I mess up the package thing, the compilation... what?
    Thanks again,
    Dusty

  • How to use Stylesheets packaged in JAR file

    Hi,
    I would like to package XSL files in a JAR. The stylesheet may import other XSL files. For example:
    <xsl:import href="demos.xsl">
    <xsl:import href="table.xsl">
    where the original stylesheet and the imported stylesheets (demos.xsl and table.xsl) are all located in this package: com.company.xsl
    Is there a way for the transformers to retrieve the files from the JAR?
    Possibly another complication is that this JAR file is loaded at runtime.
    Any suggestions would be of great help. Thanks!

    Thanks that worked.
    However, is it possible to use a relative path? Right now it only works if the absolute path is used:
    <xsl:import href="jar:file:///c:/applications/bin/myjar.jar!/com/company/xsl/table.xsl" />
    It would be nice if this worked instead:
    <xsl:import href="jar:file:///./bin/myjar.jar!/com/company/xsl/table.xsl" />

  • Packaging Utility JARs in EAR

    Hi,
    At present, we create a single enterprise archive (.ear) containing all utility packages (3rd party, framework) (jars) and EJB deployments. Our current .ear file is approximately 14MB.
    During a recent investigation to resolve a JNI DLL reloading issue, we discovered that when loading new classes for an application, the runtime environment looks for classes in the following locations (in the following order): the bootstrap classpath, installed extensions (lib/ext directory of the JRE) and the classpath.
    It has been suggested that the utility and 3rd party jars are not packaged within the EAR, but are copied to the lib/ext directory of the JRE.
    The new .ear file is approximately 2MB. The advantages of this approach is that the EAR deployment is more lightweight and is thus more manageable by the application server.
    A further advantage is that the jars are in a single location. That is, if a jar is required by more than more EAR, it resides in a single location.
    Are there any negatives or performance impacts of this approach?
    Any information or suggestions would be highly appreciated.
    Regards,
    Rennay Dorasamy

    The only real negatives are:
    1) You can't change the libraries without restarting the java process (WLS in this case)
    2) Your extensions must be isolated and not refer to any classes in the classpath or application.
    FWIW, WLS 9 includes a new feature application libraries:
    http://e-docs.bea.com/wls/docs90/programming/libraries.html
    -- Rob

  • Database for packages and jars

    Java heaviliy relies on the package concept and the idea that people use their web domain inversely as a structure for the packages is good. I find, however, the task of finding the right jar file for the package I need sometimes a bit cumbersome. Going into J2EE and other stuff you end up with many jar files on your computer.
    I have had the idea of putting together a database listing the contents of all my jar files, even designed a script that creeps into the depth of all the subdirectories to look for jar files and query their contents. Keeping such a database in shape is, however, not an easy task. I was wondering whether such a database exists already.

    In a sense, this is what maven does
    maven.apache.org

  • Packaging multiple jars in one jar file.

    Hi I have an application that is packaged into a jar, but I have a library I would like to pack with it, so that my jar-file contains the other jar inside. I thought using Java indexing (jar -i) would work, but it didn't for me.
    Any ideas?
    Thanks.

    I extract 3rd party JARs and then include them in my JAR as follows:
    jar  xf  jakarta-oro-2.0.5.jar
    jar  xf jasperreports-1.2.1.jar
    jar  xf  iReport.jar
    jar cmf  mainClass Spec  Remote.jar  *.class  org/  net/  it/The extraction of jakarta... produces the org/ path, jasperreports... produces the net/ path and iReport ... produces the it/ path. All are in my working directory as are my *.class files. I hope this is the answer you need.

Maybe you are looking for