Including jars into executable jar

Hello
I want to create an application in one application even if this application depends by many other jar libraries.
So , my development process resulted into one library: myapp.jar
This application depends by other jars: lib1.jar, lib2.jar, lib3.jar,
If I'll create one big jar archive with my classes and these libraries doesn't work (even I'll specify in manifest file all tags:
Class-Path: lib1.jar lib2.jar lib3.jar
Main-Class: com.snt.xdoc.MyApp
So, it is possible to create one single JAR archive including all resources (my interesting point is to include jar libraries) and executable class to know where are these resoures (to establish corectly the classpath)?
Thank you

Hello Stefan
Other topics about this problem can be found here:
http://forum.java.sun.com/thread.jsp?forum=22&thread=405160&tstart=0
http://forum.java.sun.com/thread.jsp?forum=4&thread=432114&tstart=0
But you might want to take a look at META JAR UTILITIES : http://www.yagga.net/java/metajar/
"Three classes with full source code and documentation that allows to extract resources from a file, from inside a JAR file that is currently executing (java -jar foo.jar), from a JAR that is included in the aforementioned executing JAR and to define a classLoader that can work with JARs, even if those JARs are JARred inside the currently executing JAR."
MetaJarUtilities are being distributed with full source code under GNU's General Public License.
For the moment being a JAR structured like this works:
FOO.jar
+- SuperMetaJarTest.class (uses BootstrapJarClassLoader.class)
+- net/
| +- yagga/
| +- util/
| +- BootstrapJarClassLoader.class
|
+- metatest.jar (content below)
| +- net/
| | +- yagga/
| | +- util/
| | +- Meta Jar Utilities classes here...
| +- jars/
| | +- test.jar
| +- TestmetaJar.class
| +- text.txt
|
+- jars2/
+- test2.jar
Good luck!

Similar Messages

  • How to include .jars?

    Hello,
    I have been unable to find out how to include in the .ear file generated by wsgen the supporting .jar files that my Web Service EJB needs.
    I thought this could be done with the "classpath" parameter in the wsgen tag in build.xml, but it doesn't seem to do anything.
    Can someone please provide a hint?
    Thanks,
    Pere

    Hi Pete,
    You mentioned the <wsgen> Ant task, so I'm assuming that you're using WLS 6.1
    An automated way to do this, is to include a series of <exec> Ant tasks after
    the <wsgen> one. These <exec> Ant tasks would call the jar.exe and look something
    like this:
    <exec
    dir="."
    executable="jar.exe"
    failonerror="yes"
    >
    <arg line="xvf ${APPLICATIONS}/MyWS.ear myEJB.jar"/>
    </exec>
    <delete dir="myEJB-jar"/>
    <mkdir dir="myEJB-jar"/>
    <exec
    dir="myEJB-jar"
    executable="jar.exe"
    failonerror="yes"
    >
    <arg line="xvf myEJB.jar"/>
    </exec>
    <copy todir="myEJB-jar">
    <fileset dir=".">
    <include name="jar1-used-by-EJB.jar"/>
    <include name="jar2-used-by-EJB.jar"/>
    </fileset>
    </copy>
    <copy todir="myEJB-jar/META-INF">
    <fileset dir=".">
    <include name="MANIFEST.MF"/>
    </fileset>
    </copy>
    <jar jarfile="myEJB.jar" basedir="myEJB-jar" />
    <exec
    dir="."
    executable="jar.exe"
    failonerror="yes"
    >
    <arg line="uvf ${APPLICATIONS}/MyWS.ear myEJB.jar"/>
    </exec>
    I realize this seems like a lot of steps, but they are at least automated :-)
    Note that the contents of the MANIFEST.MF that you copy in must look like this:
    Manifest-Version: 1.0
    Created-By: Ant 1.4
    Class-path: jar1-used-by-EJB.jar jar2-used-by-EJB.jar
    in order for the EJBs to find the newly included .jar files.
    HTH,
    Mike Wooten
    Pere Torrodellas <[email protected]> wrote:
    Hello,
    I have been unable to find out how to include in the .ear file generated
    by wsgen the supporting .jar files that my Web Service EJB needs.
    I thought this could be done with the "classpath" parameter in the wsgen
    tag in build.xml, but it doesn't seem to do anything.
    Can someone please provide a hint?
    Thanks,
    Pere

  • How to include .jar files in coldfusion code 

    To Integrate our cfm code with paypal jar files we do the
    following steps with our local coldfusion server ,and to run and
    integrate the paypal Java SDK jar files, I think we need to do the
    same process on the server, can you suggest any thing to do the
    following setting for my domain on the server, without setting the
    class path in coldfusion administrator.
    The ColdFusion application server must be configured to know
    the location of the PayPal JAR
    files, and your ColdFusion Markup (CFM) pages must be
    configured with the absolute path to
    the PayPal API certificate for the PayPal API user on whose
    behalf the calls are made.
    1. Install the PayPal Java SDK “Installing the
    SDK”.
    2. Copy a subset of the Java SDK JAR files to a location
    accessible by the ColdFusion
    application server. The JAR files are in SDK_root\lib and
    their exact names are as
    follows:
    – bcmail-jdk14-128.jar
    – bcprov-jdk14-128.jar
    – paypal_base.jar
    – paypal_stubs.jar
    sax2.jar
    – xerces.jar
    – xpp3-1.1.3.4d_b4_min.jar
    – xstream.jar-1.1.3.jar
    3. With the ColdFusion Application Server Administrator, add
    the absolute path of the
    location you determined in Step 2 to the Java and JVM
    CLASSPATH environment variable.
    4. Restart the ColdFusion Application Server.
    Suggest me how to include .jar files without setting
    classpath.

    > Suggest me how to include .jar files without setting
    classpath.
    Copy them to {CF_HOME}\lib, where {CF_HOME} is, for example,
    C:\CFusionMX7. Restart Coldfusion.

  • How to include jar files in jdk1.7

    Please can anybody tell me that how can i include jar files in jdk1.7

    You mean to add a library in NetBeans? If so, click here

  • Including jars in deployment not part of EAR project...

    Hi,
    Just trying to see if I can include jars in a separate project (due to our cvs setup) in Workshop in my EAR project so that when I deploy to the server it picks up these jars. Obviously I can include other projects on the build path so it all compiles, but is there a way of including their jars when running the server so I don't get any ClassNotFoundExceptions?
    Thanks.

    Try this:
    1. In the Project Properties for the EAR project, find J2EE Module
    Dependencies page.
    2. Add the jars located in another project as a dependency. Note that
    you have to add each jar individually.
    3. For each project that needs to see a particular one of these jars, go
    to the J2EE Module Dependencies page for that project. You should see
    all the jars listed. Check whichever ones this project needs to reference.
    When the app is deployed or exported as an EAR, the jars will be in the
    root directory of the EAR. The modules will reference the jars via their
    manifest.mf files.
    Hope this helps.
    - Konstantin

  • Include jars for compiling and exclude jars for war

    Hello,
    In the context of using ant to create a war, I have some doubts:
    Actually to compile my web application codes, I put in classpath the following two jars as:
           <pathelement location="${lib.dir}/${servlet-api.jar}"/>
           <pathelement location="${lib.dir}/${jsp-api.jar}"/>   without these two jars I would get compiling errors.
    To create a war, I have to exclude these two jars:
       <lib dir="${webapp.dir}/WEB-INF/lib">
                 <exclude name="servlet-api.jar"/>   
                 <exclude name="jsp-api.jar"/> 
               </lib>If I kept these two jars in the war, JBOSS application server would complain of duplicate classes.
    My approach works. But my question is:
    Is it the best practice to include jars for compiling codes and exclude jars if the application servers already have them?
    Best regards,
    Pengyou

    Yes. That is the best practice.
    In fact its the only practice to do it properly.
    You are compiling against Interface only. Your code will work as long as that interface is implemented by the server, even if it does different things under the hood. This is what lets your web application work on whatever server you deploy it on - Jboss, Tomcat, Weblogic - it shouldn't matter as they all implement the same basic interfaces.
    You could also expand that list to include common APIs which you know are available on your server if you don't want to bundle them with every web application.
    JSTL jars are one potential example.

  • Why is my data set marking server not included in my executable​?

    I have a program that writes data sets to a citadel database with a data set marking I/O server.  Everything works fine in the labview environment, but when I create an executable of the program, the data set I/O server does not appear to be included.  The executable can create a database and write individual traces to it, but they are not grouped into data sets.  I have looked everywhere in the project window and in the build specifications window for the executable for a setting that would affect this, but have found nothing.  Here is a picture of the build specification window for the executable. You can see in the Project Files window the lvlib file and the included Shared Variables folder, but the data set marking server is not shown as it is in the project window above it.
    The lvlib file created with the executable appears to remain in tact, because I can open it in the LV environment and see the data set I/O server included with it:
    Finally, here is a picture of the databases that MAX sees.  The VI in the LV environment produced the top database called C__Program_Files_National_Instruments_Labview_8_2_​data with the DataSets folder, and the executable version produced the bottom database called mVROC_Database with no DataSets folder:
    I'm using LV 8.2.1 and DSC module 8.2.
    Thanks,
    Craig

    Hi, Drew,
    Thanks for the reply.  As I was looking into your questions above, I found that the I/O server was indeed geting included in the executable, but it was configured in the original project to look at the wrong database.  After a fair amount of playing around, I at least got it to create data sets.  However, there are some other weird things going on now.  The logged values of the variables are mismatched, or the value from say variable A shows up recorded in variable B. This stuff is all way too touchy.  Overall, I've been very dissapointed with using the DSC and database stuff. The promotional literature talks about how easy it is to use, but that is just not the case, and I've been programing in labview for about 10 years now.  Unfortunately I need to set this project asside for now so I can't investigate further, but I'll eventually get back to it. 
    Regards,
    Craig

  • Is code in a disable structure included in an executable?

    I have a LabVIEW 8.6 VI that I would like to build into an executable.  This code includes several PXI drivers for motion control and power supply control.  I have a hardware simulation mode built into the code that will allow me to run the front panel regardless of whether the software is running with hardware or not.  There are case structures around each of the hardware driver VIs in the software.  If I am running the code normally, the cases with the hardware driver VIs will be called and they will operate the connected hardware.  If I am running the code in hardware simulation mode, the cases with VIs that fake hardware will be called.  All of this works as I intended.  The problem comes when I try to build the code into an executable and distribute it to people who I know don't have the hardware, and probably don't even have LabVIEW installed.  The problem is that these people will have to install the NI runtime support (which I am perfectly fine with) but they will also have to install the drivers for the hardware that they don't have.
    I am wondering if I were to change the case structures to conditional disable structures and disable the drivers, would that code still be included in the executable and require someone to install unused drivers to run the simulated code?
    Eric C
    Systems Integrator, National Technical Systems
    Certified LabVIEW Architect

    Hi Eric C,
    Good Morning and I hope your well today.
    Thanks for your interesting post! 
    I would like to highlight one aspect of the help file, " ..Has one or more subdiagrams, exactly one of which LabVIEW uses for the duration
    of execution,..". To me, this suggests at run time only one case will be valid. Thus, I don't believe this will act as you wish. Secondly, I am under the impression that this can't be used in an executable (compiled form - I got an error 1 when trying to). This maybe because the exe can't decide what case to use. Due to the above, I feel we should look at this issue from a different angle. 
    To make it clearer, once the code is deployed there is no longer the conditional structure OR the code in the other frames. (There are however if your making a source distribution). 
    I am guessing your driver would be calling third party dlls, and the exe will load these at the beginning. So this is likely to generate the browse window is the driver isn't installed. In your documentation you could include that this means you need to install the driver. If your user was then to run the code you could use a case structure and test that the file has been created by the installer for the driver (I.e. no install directory no driver). This would then prevent the end user running the application without the driver.
    Thus, if you feel its not ideal the customer sees the browse window then you could run the installer for the driver at the end of the NI installer, which you could include when you distribute your application.
    Please let me know  your thoughts, 
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

  • Can we make the .class file into executable one? Urgent

    I just made some java programs, which consist of some GUI and robot, and I need to make them into executable file, mean .exe file. From this forum, there was a suggestion to use Excelsior JET that can make .class files into .exe files.
    and when I tried to use the program, it did the job well, but when I try to put the .exe file into another PC, it can not run as if I run it on the system that I made the .exe file.
    Is there anyone experience this before? is there other solution? and is the the .exe file that has just been generated already include all .class file that are needed by the main .class file that has been converted into .exe?
    Thnks for the helps...

    It is sort of possible.
    A good way of doing this is to use an application called Install Anywhere. With this, you can create an installation file for your application, and it does create an executable. Ive used this a few times myself, and it is really easy to use.
    I think another app to do this is one called JToExe (i think), and this basically creates an executable.
    I hope this helps,
    Osh

  • How to include components into mxml file?

    I have an mxml file with multiple states and it is getting
    quite large. I would like to divide these states into their own
    components. How can i include these into the mxml file?
    Thanks!

    I couldn't be happier that you asked this question and if you
    don't mind I'd like to extend on it a touch since it directly
    relates to my topic.
    I am right with Dr. Goomba (Great name) when it comes to
    filesize of a single application.
    The flash player has always been a big proponent of small
    file size and fast dowloads to ensure our users have a pleasant
    experience in our applications. I have been going through the
    documentation tirelessly and the only mention I really see as a
    supporter of that theory is "RSL" documentation which, believe it
    or not, actually advises against them unless you are using them
    across multiple apps.
    So, my question is a tack on to Dr. Goomba (Answer his first,
    this is just a supporter):
    Has Flex 2 moved us away from fast delivery? I have an
    application already up to 300k that could easily reach the 700k
    range (I think, based on my total progress so far) - It doesn't
    seem to me that the focus is still on loading things in parts like
    the MX 2004 RIA days.

  • How to include ehp4 into ecc60 upgrade

    Hi ,
    I have a question about EHP4 and upgrade.
    I have SAP R/3 4.7 win/sql 64bit and i want to include EHP4 into the upgrade.
    I have downloaded EHP4 stack from MOPZ .
    Is during the prepare that sap ask me to include EHP4 : so if i answer yes what will appen ? prepare search for the xml file and bind the EHP4 in the same way of the sap pathc  (BINDPATH)?
    Is r3up that automatically include EHP4 into the upgrade during downtime or ,at the finish of r3p, i have to run the
    ehpi installer and do SPDD and SPAU more than one time ?
    Thanks a lot for the answer !!!!

    Hi,
    You can do the upgrade untill ECC 6.0 EHP4 in one step, just download the files or put an order with SAP so they can send you the media. There is a set for upgrade specifically for this. If you wanted to upgrade to ECC 6.0 EHP1, EHP2 or EHP3 then you need to do it in two steps but in your scenario only one step is necesary.
    By the way now you will use SAPup, not R3up like before
    Regards,

  • Extracting masterdata - include ZXRSAU02 not executed

    Hello experts,
    We are trying to extract MD from R3 using transaction code RSA3.
    We have some fields enhanced in a customer exit.
    The function module EXIT_SAPLRSAP_002 is called (program LXRSAU02).
    <b>----> The include ZXRSAU02 is not called <--
    </b>
    Does someone know why this include isn’t executed?
    <b>INFO</b>
    We have two systems D and Q.
    We have modified ZXRSAU02 in D, and it works.
    We have transported ZXRSAU02 from D to Q and the include is not called
    Everything is active in both systems:
    Project – Function module - include
    <b>Differences</b> between D and Q:
    The only difference is an empty line at the end of the include.
    I don’t know where this last line come from, since I’ve recently retransported the include.
    I can not generate this last line in D, when I activate the include, the last empty lines disappear (in D).
    <b>Debugging</b>
    When we debug the extraction in <b>D</b> we find:
    1.- SAPLRSAP -> form CALL_MSD_CUSTOMER_FUNCTION
      We put a breakpoint before the CALL CUSTOMER-FUNCTION '002'
    2.- We press F5
      We are inside the include ZXRSAU02, in the first instruction
    When we debug the extraction in <b>Q</b> we find:
    1.- SAPLRSAP -> form CALL_MSD_CUSTOMER_FUNCTION
      We put a breakpoint before the CALL CUSTOMER-FUNCTION '002'
    2.- We press F5
      We are inside LXRSAU02, but in the line 21 (ENDFUNCTION after the include ZXRSAU02, which has not been executed)
    See below LXRSAU02 in <b>Q</b>:
    FUNCTION EXIT_SAPLRSAP_002.
    *"*"Lokale Schnittstelle:
    *"       IMPORTING
    *"             VALUE(I_DATASOURCE) TYPE  RSAOT_OLTPSOURCE
    *"             VALUE(I_CHABASNM) TYPE  SBIWA_S_INTERFACE-CHABASNM
    *"             VALUE(I_UPDMODE) TYPE  SBIWA_S_INTERFACE-UPDMODE
    *"       TABLES
    *"              I_T_SELECT TYPE  SBIWA_T_SELECT
    *"              I_T_FIELDS TYPE  SBIWA_T_FIELDS
    *"              I_T_DATA
    *"              C_T_MESSAGES STRUCTURE  BALMI OPTIONAL
    *"       EXCEPTIONS
    *"              RSAP_CUSTOMER_EXIT_ERROR
      INCLUDE ZXRSAU02.
    ENDFUNCTION.
    Please, help me with this X-File.
    Thanks and regards
    --Zorion

    Hi all,
    The issue is solved now.
    In the TQM system we have “generated program” within the include
    SE38 -> view ZXRSAU02
    PROGRAM -> GENERATE
    (program saplxrsa has been successfully generated)
    Best regards

  • Include variable into xpath expression of transformation activity

    Are we able to include variable from the BPEL process into the xpath expression of the transformation activity?
    I tried it but I received error saying it does not recognize the function bpws:getVariableData('loopCounter') when I included it into the xpath expression inside the transformation.
    Thanks.
    Kenny

    Maybe I am giving a bad example. Instead of bpws:getVariableData('loopCounter'), I need something like bpws:getVariableData('accountName') which is being used in the filter like /root/accounts/account[name=bpws:getVariableData('accountName')]
    The assign will not work in this xpath expression because it return multiple nodes in source.

  • Can I include CSS into XSL?

    Hi,
    I'm using XSL to transform XML.
    We already have predefined CSS that has fancy font/color etc..
    Can I somehow include that into XSL?
    Thanks much
    IL

    This should help:
    <link rel="stylesheet" type="text/css">
    <xsl:attribute
    name="href">/path/filename.css</xsl:attribute>
    </link>Or this, if you like to keep your code simple:
    <link rel="stylesheet" type="text/css" href="/path/filename.css"/>

  • Include webshop into app magazine / animation question

    Hello,
    I have a few question as regards:
    1) Webshop:
    is it possible to include webshops into an app magazine via the Adobe DPS Single Edition (or only Professional Edition)? This is the webshop I'm talking about that should be included in the app magazine: http://www.blooms.de/ShopRubriken/128143.html?UID=7F46330ACD307CB6A9DA366D9D969CEC3CCEC71A 3FC29CAC10E3AA
    I researched on the internet and saw how Lakeland did it (Adobe Digital Publishing Suite – Marketing-Materialien). They linked to the webshop on the internet what looks like the easiest (also best?) solution. But is there a good way to include the webshop directly into the app magazine rather than linking to it?
    In my research I've also come across this video: Adobe Digital Publishing Suite delivers a rich immersive commercial experience for Shop Direct | Digital Publishing Suit… It looks like a webshop too but integrated into the app. How does this solution work?
    And: How do I get analytics for the shop if it's embedded in the app magazine?
    2) Animations:
    I would like to animate text/textboxes into a full screen background picture. I've read that animations with PDF format (for crisp text on the app!) are not supported. How do I solve this problem?
    Many thanks in advance,
    Helene

    1) You can integrate it via a web overlay, but honestly it is far less complicated and much more likely to work if you just include hyperlinks to your existing web shop and have the reader do the purchasing in the in-app pop-up browser.
    2) This is pretty much impossible to do without doing a bunch of work in Edge Animate. To be honest, I don't really think it's ever worth the time spent. I'd look at doing a different design instead that doesn't rely on that style of animation.
    Neil

Maybe you are looking for

  • Interview questions help

    Hi friends i have some interview questions please give me good answers.thanks for advance. 1.what is info provider?what is advantages and disadvantages? 2.when your working process chains you set up 2 jobs ,one is 12 pm and anothet 3 am.when you come

  • Static memory utilization in a utility class

    I have a servlet calling a utility class, this utility class has a bunch of static methods. One of these static methods is called getStreamCon() returns a http connection to another server(getStreamCon() has few variables whose scope is limited to th

  • MSI tv@nywhere users plz read :)

    lo guys, I'm sorry i have to ask such a newb question..altho i am kinda new at this...but can anyone tell me how they installed their Tv@nywhere with Windows XP? the drivers for me don't seem to work..when i install it...i get the windows xp error sa

  • Activate BI content - not taking the good datasource

    Hello, When I copy Bi contents, the datasource is coming from my BI system (client 000) but I want to extract from the datasource coming from my other logical system client 001. How can I configure BI contents activation to search datasource and use

  • HT4943 How do I turn off automatic renew?

    I'm trying to turn off automatic renew on my magazine purchases. Anyone know how to do that?