Refer external Jars

Hi All,
Is there a way in which one could refer to external jars through the manifest of a jar file. For example, i have the following directory structure:-
product
|
|- bin
| |
| |- myproduct.jar
|
|- lib
| |
| |- resource1.jar
| |- resource2.jar
Now, is it possible to set the resource1.jar and resource2.jar in the classpath of myproduct.jar so that myproduct.jar can use the classes in these jar files?
For your information, myproduct.jar is an executable jar, which has a main class attribute defined in its manifest file.
Thanks a lot in advance,
Regards,
Dev.

I have the same problem, I think, but your solution did not work.
I have a directory structure:
java/com/bti/acecomm/syslogwatch
I have my classes in syslogwatch and mail.jar and activation.jar in java directory.
I went into the java directory and ran jar -cvmf SyslogWatch.mf syslogwatch.jar com
The manifest has:
Main-Class: com.bti.acecomm.syslogwatch.SyslogWatch
Class-Path: activation.jar;mail.jar
I complains:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
at com.bti.acecomm.syslogwatch.SyslogWatch.main(SyslogWatch.java:95)
javax/mail is in mail.jar.
I am not sure what I am doing wrong.
David

Similar Messages

  • Urgen - refer external jars from tomcat container

    Hey guys,
    can any one help me how to refer external jars from tomcat.
    In other words, one of the webapps is need external jar. However, we should not copy that jar into web-inf\lib rather we should refer that jar which is located in the same machine.
    Appreciate your help.
    Thank you,
    Prithvi.

    I am not sure if either of my suggestions will be helpful but you could put the jar files into tomcats shared\lib if that is appropriate. Another option is that you could put your jar files into some directory and then reference them in your WEB-INF\lib directories using symbolic links.

  • How to call external jar files in EJB project for CE

    Hi,
    I would be thankful if someone could help me with this -
    I need to call the external jar files into my EJB project - Here is what I have done and am getting runtime exception as  -
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    1. Created a EJB  project" HelloWorld "  using Java perspective in NWDS 7.1 called with client as HelloWorldClient and EAR project as HelloWorldEAR.
    2. Am working on HelloWorld project (1st one).
    3. In my code I am instantiating a class which is a class in one of  the external jar file that I need to refer in my project.
    4. I have set the Java Build path but it works only for the compile time and fails during runtime.
    5. Have read I need to create external library DC and refer in my project "HelloWorld".
    Can anyone help me with exact steps what needs to be done - during creation of external library project and then for my "HelloWorld" EJB project. How would I be able to reference or set the external library project in my EJB project?
    Looking forward to hear from experts.
    Thanks,
    Shiv
    Edited by: Shiv Khullar on Aug 30, 2010 9:39 PM

    Hi Edson,
    I tried it , but it still gives me runtime exception.
    javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
    Steps I performed are -
    1. Created a library project and created 2 Public parts "Compilation" and "Assembly"
    2. Build the library project.
    Now in my EJB project using Project Explorer - set the classpath and added both compilation jar and assembly jar files.
    This is how the classpath entries for external library looks like -
    <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkAssembly/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkAssembly.jar"/>
         <classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkCompilation/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkCompilation.jar"/>
    I have also added the jar files I used in my external library project as "User Library" from Java Build Path . I dont do it , then the code fails during compilation itself.
    Regards,
    Shiv

  • How to access external JAR in EJB ?

    In Web applications, we can keep external jars used in WEB-INF/lib directory.
    How to achieve same in an EJB ?
    Thanks,
    George

    "George" <[email protected]> wrote in message news:[email protected]..
    In Web applications, we can keep external jars used in WEB-INF/lib directory.
    How to achieve same in an EJB ?If you are on weblogic 8.1, you can put the jars into APP-INF/lib in ear. If it's not the case, you should refer the
    jars in MANIFEST.MF of corresponding ejb-jars.
    HTH.
    Regards,
    Slava Imeshev

  • How to use one external jar (SDK) for several apps in WTK?

    Hi,
    I have one external jar (SDK) I use for developing J2ME applications.
    Every time I have no choice but to copy this JAR (SDK) into my current application lib directory.
    I am building a family of MIDlets that I dont want to put into just one huge JAR but rather to have several JAR files for each application.
    In C world I need only to tell the linker where it should pickup ".so" or ".lib" file.
    Is any way to do the same with WTK? Or any other J2ME development tool?
    Thanks in advance,
    Andrew

    Link to wtk2.5 beta has been posted to this forum
    while ago. It's worth to try it It is MSA1.0
    compliant. It has many new JSRs.TomTom,
    Thanks again.
    I tested the WTK2.5BETA and here I ahve strange fact. My application works perfectly on WTK2.1, WTK2.2 WTK2.3 BETA but it crashes with a very weird message on WTK2.5BETA
    Method............: 22482ac 'com/tinyline/app/SVGEventQueue.handleEvent (virtual)'
    Stack Chunk.......: 2216e44
    Frame Pointer.....: 2216e7c
    Current IP........: 224820b = 22481fc + offset 15
    Previous Frame....: 2216e58
    Previous IP.......: 226afd6 (offset 26)
    Frame size........: 3 (2 arguments, 1 local variables)
    Argument[0].......: 20bc0b8
    Argument[1].......: 2216d7c
    ALERT: java/lang/NoSuchMethodError: No such method dispatchEvent.(Lorg/w3c/dom/events/Event;)Z.
    So I thought, OK it was compiled under WTK2.1 may it was the reason of crash.
    I took sources and compile them under WTK2.5 BETA. I came up with the same result - crash.
    Thanks,
    Andrew

  • How to refer a .jar file in the code.

    How to refer a .jar file in the code.
    I want to use a library dnsjava.jar, which I download from the internet. I want to know how to refer it
         If I am compiling the code on Solaris
         If I compiling the code on windows using eclipse.
    I added the following line in my code to refer to this library. But it always complains of not found the class
    import org.xbill.DNS.*;
    I tried the following to add this library but did not work
    On eclipse/windows: Went to window-> preferences -> BuildPath _> class path Variable.
    On Solaris: Could not add this library /opt/java_reference/v1.6.0_04/jre/lib. Although I am logged in as root, but not able to add the library there. Complains of Permission denied.

    Set the classpath option when compiling.
    javac -classpath /path/to/lib/dnsjava.jar YourProgram.java
    I don't use Eclipse, but it probably has a library list on your project preferences. Add it there.
    Regards,
    Henrique Abreu

  • Getting error while calling external Jars in BPEL by using Java embedding activity in soa 12c

    Hi,
    I am trying to use an external Jars for the business logic implementation. Here I need to pass XML as input and
    and I expect the "Password " field has to be return.
    Following are the steps I have followed:
    1) Created a java project with sample class and added the external jars into the project "Libraries &Classpath".
    2) Created a jar file out of it.
    3) Created a BPEL project with Java Embedding.
    4)Wrote the java code in java embedding activity.
    4) Added the above created jar file to the BPEL project's lib/jar  and added in SCA-INF/lib project folder as well.
    5) Imported the package with the class as in the jar (e.g <bpelx:exec
    import="pkg.testInterface"/>)
    6) Deploy the BPEL project.
    while deploying the SOA build is sucessful but my depoyment is incomplete.
    error:
    advices will be great....
    Regards,
    Dilip

    Hi,
    Can you confirm if the BPEL Version is 1.1 or 2.0.
    If you are using BPEL 2.0 you need to import the required jar/class file as:
    <import importtype="http://schemas.oracle.com/bpel/extension/java" location="pkg.testInterface"/>
    For BPEL 1.1 the syntax to import other jar/class file is:
    <bpelx:exec import="pkg.testInterface"/>
    If you import the classes in the correct format you will not face any deployment error.

  • Help need in Adding External jar files.

    Hi all,
    Iam developing ADF application using JDEV 11.1.1.3.0.
    I need to move files from one directory to another so i have used external jar "commons-io-1.4.jar" file.
    i did this by going to the project properties -->Libraries and Classpath -->Add Library
    added the jat file.
    In java class i have used the function
    File.copyFileToDirectory(reQueueFile, TargetLocation,false);
    it was working fine when i tried in IntegratedWeblogic server but when i deploy in Standalone Weblogic server its not getting the jar file.
    Its throwing me the exception
    javax.el.ELException: java.lang.NoSuchMethodError: org/apache/commons/io/FileUtils.moveFileToDirectory(Ljava/io/File;Ljava/io/File;Z)V
    at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1303)
    Please let me know is there a way of adding the lib to the project.
    Regards,
    Suresh kumar.k

    First you should check that the library has the checkbox 'Deploy by default' is checked for your library.
    The you open the project properties of the view controller project, select Deployments, edit the deployment descriptor. Select the Node 'File Groups'->'WEB-INF/lib'->'Contributors'. this should give you a list of libraries your project uses. Check if your library has the checkbox checked (is selected fro deployment). If it's not checked, set it.
    This should include the library.
    Timo

  • Including External JARs for Java Application in OC4J

    Hi Experts,
    Here is my requirement.
    I have developed my Java application using Tomcat Server & Eclipse. In my application I have used some External JARs & imported the classes in my JSP.
    Now that I'm using OC4J Server instead of Tomcat I'v no clue as to where I have copy these External JARs for my application to work.
    I have installed OBIEE-Client which includes OC4J server. The path where I have placed my application is as below
    *"C:\OracleBI\oc4j_bi\j2ee\home\default-web-app"*
    If I run my application the server does not import the classes in the JSP which we include using Import statement using JSP tags (*ex* - <%@ page import = "org.apache.commons.fileupload.*"%>).
    This is the location which I found, where I need to put my Java-J2EE application. This OC4J_BI comes with OBIEE.
    Kindly help me out on where to place these External JARs exact location in OC4J.
    Also let me know if I have to alter any configuration/xml file (if so pls specify the file name & its location).
    Thanks in advance,
    Venky

    You can either include the external libraries in the application, by placing them into WEB-INF/lib, or you can import them into the server as "shared libraries", normally you'd use the "enterprise manager" application to do this. Having loaded a shared library you then add it to the classpath when you're deploying the application.

  • How to include external jars - URGENT...

    Hi:
    I am using Eclipse for development.
    My application uses some external jars.
    This step is simple in Eclipse, one simply indicates where the jars are to the IDE.
    However, when I make an executable JAR file from my project, those external JARs are not included.
    So when I run my program, everything is fine until the parts that uses the external JARs.
    Does anyone know how to include them outside of Eclipse platform?
    I am going to see my client in an hour and of course I can't bring my source and install an Eclipse at my client's computer to show them my demo...
    please help... thanx...

    You add those external jars to the classpath or the jars classpath if you're running the program from a jar. Or put the external jar to JAVA_HOME\lib\ext (IIRC)

  • How to handle External Jar files in EJB DC

    I have created a EJB DC.
    I have added the required MDM Jar files to the class path.
    These MDM Jar files are supplied by SAP for integration with Master Data Management.
    But the DC build fails.
    If I create the same project as a <b>REGULAR</b> EJB (non-dc approach)project, everything works fine.
    Qn:
    How to bundle the MDM jars (External jars)in a DC?
    How to create the Public Parts in the DC for the added MDM External Jars?
    How to use the above DC in the EJB DC?
    Basically, I am looking for a step by step procedure,
    to add external jars in a DC.
    And to use the above DC in a EJB DC.
    Any assistance in this regard is appreciated.

    You should not reference the MDM jar files by setting classpath directly. For setting references to it from your EJB DCs , you will have to create a DC of type "External Library". Deploy this DC also before your EJBs are deployed. You will then have to create a public part for this DC and the reference the public part from the DC metadata of the EJB DC ie set the Used DC list of EJB DC to the public part of the ext lib. You will get info about this in NDS help as well on help.sap.com

  • How to include an external jar file in .EAR project

    Hello All,
    I have created a web service through java class in sap netweaver 7.1.
    For database connection i want to add external jar file as reference. could you all please tell me how to do this or can i get some scenario where it is explained.
    Please Help
    Regards,
    Vanita Jain

    Hi Vanita,
    open your project in nwds > right click on the project > click on properties option from the menu > click on java build path from the left-side navigation of the window > and click on libraries in the right side tab > here you'll get a button called add external jars > clicking to this, will open browser window to select a jar file.
    Regards,
    Sen

  • External jar not included in ear

    hi
    I created a library dc with an external jar in its public part and this library dc is used in a j2ee library dc (like described in [ Howto embedd external Jar in EAR    |;).
    my enterprise application project uses a web module dc and this j2ee library dc.
    so far..but when I deployed the buildt ear and call my application the classes which are in my external jar file can´t be resolved at runtime.
    what´s my fault? has anyone an idea?
    Edited by: Thorsten Winter on Feb 4, 2008 2:47 PM
    I am working with nwdi and nds and developers workplace sp 13 and web as 7.0

    Hi Thorsten
    Please follow the blogs
    /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro
    /people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas
    Hope it helps
    Regards

  • How to import external jars in a CAF project?

    Hello Experts!
    Could you help me find out the way to import external jars in a CAF project. I have tried to import the jars
    in ejbmodule using "java build path--->libraries". But while trying to build the project it's displaying error and all the imported jars automatically get removed from the list.
    I have read that creation DC of type "External Library" can help me.
    1) Create a DC of type external library
    2) Copy my jars to folder "libraries"
    What should I do next? And how can I import my DC of type "External Library" to my CAF project?
    Looking forward for your suggestion.
    Thanks & Regards
    Vitaly

    Hi,
    This article will guide you how to deploy the external jar files to the application server.
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60a0f850-c451-2c10-a6a6-ddcabfa3a65b&overridelayout=true
    Add the library project to the public part of your caf project to use the jar files.
    Regards,
    Gayathri

  • How to include external .jar libraries

    hi,
    I'd like to use an external .jar library in my Java program.
    I import the package in the source code.
    But where do I have to specify the file location of the .jar file. Do I have to add its directory to the PATH environment variable or somewhere else??? So far I've done this only in Eclipse, but now I'm working in a pure linux environment... with no IDE.
    Thanks :)

    Or specify the classpath completely when you run javac.
    For example to compile a class called Foo in the current directory which uses classes from an external jar file I would say
    javac -cp .:../../whatever.jar Foo.javaAnd if Foo has a main() class:
    java -cp .:../../whatever.jar Foo(If you are working with a number of projects each with lots of classes and lots of (different) jars, it might be time to look at Ant.)

Maybe you are looking for

  • Z97 Gaming 5 BIOS update problem.

    Hi. Firt of all i want to apologize for my bad english  . Yesterday i bought MB form subject and i want do update my bios ( curently ver 1.4 ). When i want flash under Windows ( Windows 8.1) program doent do anything, when i use M-Flash it stucks on

  • Photo Streaming on iCloud

    I have an iPhone 3GS with IOS 5.0.software.  When I first set up iCloud, photos streaming worked.  I was trying to delete some photos from the Photo Streaming folder on my iPhone and I deleted them from the Photo Streaming folder on my computer, but

  • Nikon D800 and Lightroom

    I have Lightroom 3 currently and updated to 3.6 I purchased the Nikon D800 and shoot my images with the RAW setting. However, these images will not transfer to Lightroom. I was told that I need Lightroom 4 in order to be able to transfer RAW images.

  • Cursor Problem - Cursor is not where it should be when used

    Hello, IO hope someone here has had the same problem and knows why it is occuring. this keeps happening to me on both my laptop and desktop, when I open Photoshop CS4 everything is fine with the cursor, meaning where ever I place the crosshairs of th

  • JAXB Messing up my XML Signatures

    I have a requirement to sign an XML message. Currently our schemas (being ISO20022) have to have the XML signature located in a particular part of the message even though the signature is based on an XPath elsewhere in the message: (Ignore the fact t