External Jars in program

Hello,
Sorry I know it's not an eclipse forum, but I couldn't get answers anywhere, so I hope someone here can help.
I have browsed the net a lot, and found that a lot of people are having similar issues, however I did not manage to make this work .
I have an rcp application which is just a GUI for using my application.
I also have another eclipse java project which has the core classes.
I want people to be able to use either the GUI or directly the JAR file created out of the second project.
Now the troubles :
the second project uses external jars, which I do NOT want to be packaged. I want the users to get those jar separatly and place them in the appropriate folder.
The first one (GUI) uses the second project (well it uses its jar file).
Inside eclipse I can make it work fine, problems come whenever I want to export either the GUI or the JAR from the second project.
What I would like to achieve is the following :
1) If they want to use the GUI, then there is a lib folder in its tree where they have to place all the external jars (and maybe the second project jar too, well I guess)
2) If they want to import the second projet jar in their own application, they have to get the external jars too and place them .... (somewhere? same directory I believe)
Now I have tried everything I found on the net without success : Add External Jars, add Jar, runtime tab, build-path, class-path, Project dependency, manifest etc ... in second or both projects.
I know the solution is somehow in those, but I just can't get it to work. Usually I get export errors on the RCP, sometimes its during execution.
If anyone could explain me step by step what I should do to achieve what I need, I would greatly appreciate it because it's kind of driving me mad.
Marh

On 22-Jun-11 06:11, [email protected] wrote:
> Hi,
>
> I am new to Java world and surely to eclipse, after years using Delphi.
> I am learning to become a real Java developer utilizing eclipse. In my
> starting pace I found so amuzed and also confused about Java. Every try
> to write a simple program I always use so many external JARs in my Java
> project. Is there any pitfall using exessive external JARs in a project
> ? And how can I know not to use certain external JAR without
> try-and-error removing one by one ?
>
> Thanks in advance,
> Zhou.X.B.
Don't worry about how many JAR files you end up using. Don't go out of
your way to add JARs unless you know you need them. Typically, you write
code based on what you learn from research and add the JARs you need.
Usually, you won't acquire a lot of unnecessary JARs, but even if you
do, it doesn't hurt (except for a bit of diskspace).
Later, you'll discover which JARs you did or didn't need.
In short, don't worry about this. Just move ahead. You're on the right
track since you chose Java in the first place.
;-)

Similar Messages

  • 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 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.)

  • How to use external JARs in Eclipse

    Hello.
    I created a jar file like that:
    jar -cvf0 WarShell.jar WarShell.class
    I want to use WarShell.class in Eclipse but it not in my classpath,so I choose [Project] -> [Properties] -> Java Build Path -> Libraries -> Add External JARs and add WarShell.jar to the list.
    But when I run the program I got a Exception:NoClassDefFoundError.
    Why?How to fix it?
    Another question... Your classpath is not available in Eclipse,right?
    Thanks for your time! ^_^

    Hello.
    I created a jar file like that:
    jar -cvf0 WarShell.jar WarShell.class
    I want to use WarShell.class in Eclipse but it not in
    my classpath,so I choose [Project] -> [Properties]
    -> Java Build Path -> Libraries -> Add External JARs
    and add WarShell.jar to the list.
    But when I run the program I got a
    Exception:NoClassDefFoundError.
    Why?How to fix it?Did you run your program from Eclipse ?
    If yes, it should work (or seek for an Eclipse-specific forum.)
    But if not, keep in mind that your project settings are limited to Eclipse. You'll have to define a correct classpath for running your application.
    Another question... Your classpath is not available
    in Eclipse,right?Mine? I don't think it is available for anyone ;-P

  • External Jars in JSP Dynpage

    Hi,
    I have implemented reading an XML feed in a Java program using informa api.
    In NWDS, I created a Java Project. And as required added 3 externals jar files.
    I had to import the following:
    import de.nava.informa.core.ChannelIF;
    import de.nava.informa.core.ItemIF;
    import de.nava.informa.impl.basic.ChannelBuilder;
    import de.nava.informa.parsers.FeedParser;
    The program works on run.
    But when I creat a JSP DynPage and I add the follwoing lines:
    <%@ page import = "de.nava.informa.core.* "%>
    <%@ page import = "de.nava.informa.impl.basic.ChannelBuilder "%>
    <%@ page import = "de.nava.informa.parsers.FeedParser "%>
    I get an error: Error occurs during the rendering of jsp component. Even in this project I added external Jar files in the same way.
    Any particular stuff need to reside on the server or something?
    Because I one tried implementing JCO in JSPDynPage by adding the external jar in the project structure and it worked fine.

    Hi Prem,
    Probably the jars you must have added in your last project would be available on the server or they would have been some server related jar files.
    But in the case when you are inclusing some external jars, you need to inclusde it both as "<b>External Jar</b>" and also add it to the <b>lib</b> folder (ie: just copy and pate the jar files in the <b>lib</b> filder).
    <b><a href="http://img142.imageshack.us/img142/8168/solution4gy.jpg">Put the .jar file here</a></b>
    I hope this solves your problem.
    Regards
    Pravesh
    PS: Please consider rewarding points if helpful and solved.

  • Linking external jar when starting java -jar problem

    Good day!
    A have a little program:
    import org.apache.log4j.Logger;
    public class CMDClient {
         static Logger log;
         public static void main(String args[]) throws Exception {
              log.info("test");
              System.exit(1);
    }I created a test.jar file, containing only this test class. When I start it by java -jar test.jar it cannot find linked (through import) Log4j library. Is there a way to link external jar to "jared" application?
    Good day!
    A have a little program:
    import org.apache.log4j.Logger;
    public class CMDClient {
         static Logger log;
         public static void main(String args[]) throws Exception {
              log.info("test");
              System.exit(1);
    I created a test.jar file, containing only this test class. When I start it by java -jar test.jar it cannot find linked (through import) Log4j library. Is there a way to link external jar to "jared" application?
    Good day!
    A have a little program:
    import org.apache.log4j.Logger;
    public class CMDClient {
         static Logger log;
         public static void main(String args[]) throws Exception {
              log.info("test");
              System.exit(1);
    I created a test.jar file, containing only this test class. When I start it by java -jar test.jar it cannot find linked (through import) Log4j library. Is there a way to link external jar to "jared" application?
    Error was: java.lang.NoClassDefFoundError

    There's a Class-Path attribute in the manifest.

  • How to add external jars in the configuration of JSmooth?

    Hello,
    I am trying to create an exe file from a java program using JSmooth.
    The program is a simple hello world proogram.
    I am developing under eclipse, and I am using some external jar files as libraries.
    If my program is simple,; it works fine. If I add an import of a class that is in one of these jar files, I get the following error when executing the created .exe file:
    "Could not find the main class. Program will exit".
    I guess I have to add this Jar file to the path for the creation of the .exe file.
    My question is: does anybody know HOW to add an external jar in the configuration of JSmooth for the creation of an exe file from a Java program?
    Thanks for your help
    Philippe

    i have the same problem phsans
    you know the answers??
    thanks phsans:D

  • External Jar

    Hi,
    I have implemented reading an XML feed in a Java program using api.
    In NWDS, I created a Java Project. And as required added 3 externals jar files.
    I had to import the following:
    import de.nava.informa.core.ChannelIF;
    import de.nava.informa.core.ItemIF;
    import de.nava.informa.impl.basic.ChannelBuilder;
    import de.nava.informa.parsers.FeedParser;
    The program works on run.
    when I creat a JSP DynPage and I add the follwoing lines:
    <%@ page import = "de.nava.informa.core.* "%>
    <%@ page import = "de.nava.informa.impl.basic.ChannelBuilder "%>
    <%@ page import = "de.nava.informa.parsers.FeedParser "%>
    I get an error: Error occurs during the rendering of jsp component.
    By,
    Rohit,

    Hi ,
    But in the case when you are including some external jars, you need to include it both as
    "External Jar" and also add it to the lib folder
    I hope this solves your problem.
    Kind Regards,
    S.Saravanan.

  • Export JAR from NWDS does not include external JARs imported to project

    Hi.
    I'm need to develop and run a batch java program.  I'm having difficulty getting the application to find the 2 external JARs at runtime.
    For compile time, I have physically imported these 2 JARs into the project.  To add them to the build path, I selected "Add Jar".  I now see the JARs in the project.
    I've also update the Manifest file appropriately by adding this line.
    Class-Path: com.sap.security.api.jar logging.jar
    However, when running the program from the command line, I get class not found errors.
    I noticed that the exported application JAR does NOT contain the needed 2 JARs even though they clearly exist under the project.
    Am I going about this correctly?  Why do external JARs not get included in the application JAR that is created?  Can I somehow force them to be included?
    Thanks,
    Kevin

    Hi Kevin,
    why don´t you just add the two additional JAR files to the classpath at runtime:
    java -cp x1.jar;x2.jar -jar yourJar.jar
    This is the easiest way to start your Java app.
    Have a look at java - the Java application launcher for details.
    Regards Helmut

  • External Jars in Classpath are removed by DC build. Please Help

    Hi All,
    I have a problem with my classpath. Everytime I try to build a DC some parts of my classpath are emptied. Most notably the external JAR: com.sap.security.api.jar.
    It makes it  it impossible to do a DC build and use the components in other DCs.
    I already tried to add it as a variable like this:
    Name: SAP_SECURITY_LIB_HOME
    Path: C:/Program Files/SAP/JDT/eclipse/plugins/com.sap.security/lib/com.sap.security.api.jar
    It didn't help either.
    This problem makes it impossible for me to work with DCs. What am I doing wrong?
    Thanks in advance,
    Jeschael

    Hi Jeschael,
    Instead of adding the "com.sap.security.api.jar" by going to the properties,  add the same as Used DC.
    1) Go to DC Meta Data
    2) Right Click on the Used DCs
    3) Select Add Used Dcs
    4) Go to the SAP-JEE compartment under Local Development
    5) Select the DC "com.sap.security.api.sda"->Finish.
    If you add library in this way your problem will be resolved.
    Regards,
    Jhansi

  • Using an External Jar file

    I was hoping my intro programming class would be easy, as I've done some C++ before, but go figure, it's not.
    Although the language/concepts aren't to difficult to learn, it seems compiling programs is. For one program, I'm giving an external .jar file to use. I'm using crimson editor and I do have it setup with the jdk1.6.0. It compiles all my other programs besides this one (command line doesn't work either).
    Essentially, I've created a project, I have an instantiable class, and an application class. I can call the instantiable class in the app class and creating/modifying objects works just fine. Then I have a .jar file added to the project that came from the class (supposed to be used for I/O, don't know why we can't just use the standard java classes, but oh well). anyways, when I try to call the methods in the .jar file I get the following error:
    ---------- Capture Output ----------
    "C:\Program Files\Java\jdk1.6.0\bin\javac.exe" file.javafile.java:6: cannot find symbol
    symbol : variable externalJar
    location: class file
              int value = externalJar.getIntInput();
              ^
    After doing some searching, I found that it might be due to the classpath. So I set the classpath to the directory.. no go. Then I set the classpath to the externalJar.jar file and I get the follow error:
    ---------- Capture Output ----------
    "C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -classpath C:\folder\externalJar.jar file.javaerror: error reading C:\folder\externalJar.jar; error in opening zip file
    I'm at a loss. It works when I use Eclipse and I can just add the external jar file, but I don't want to use eclipse, it's slow and bulky. Any other solutions to this problem? Thanks.
    E-Rod
    *names were changed for a reason.. i already know i'm not misspelling anything                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The error about not being able to find the variable externalJar has nothing
    to do with the classpath. It's just that your code in file.java refers to this variable,
    but you have not declared it anywhere.
    Variables within a class, the names of classes and the names of .jar files
    which contain packages have nothing whatsoever to do with one another.
    If you are using a variable externalJar intending it to reference your external jar
    file in some way, then your file.java code is seriously wrong.
    (Also, classes and their associated source files should begin with an
    uppercase letter.)
    Regarding your attempt to specify the classpath when you invoke the
    compiler (always a good idea), I think you should also include the current
    directory (if that is where file.java is). Like this:"C:\Program Files\Java\jdk1.6.0\bin\javac.exe" -classpath C:\folder\externalJar.jar;. file.javaThe "error opening zip file" thing is odd. Make sure you are
    able to read it (permissions OK, no other process has it locked). And that
    it's not corrupt (Did you create it? If so, rebuild it. If not, aquire another copy.)
    Sorry for the generalities and guesswork, but without seeing any code and
    without knowing your directory structure or the contents of this externalJar.jar
    it's hard to do any more.

  • 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

  • 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.

Maybe you are looking for

  • Problem adding custom area to ESS

    Hi All, I have created an Area in SPRO and done all the sub area, service assignment with the PCD page path. When I click the link on the Portal I get an exception saying Fatal error: Area ZNEWAREA does not exist In the XssMenu iview, when I change t

  • Since I upgraded to Mavericks X, I don't have "permission" to open my photo files in Time Machine.  Other documents seem to work fine.

    Since I upgraded to Mavericks X, I don't have "permission" to open my photo files in Time Machine.  Other documents seem to work fine, and I am the only "administrator".  

  • IBook wear and tear

    Hi everyone. I'm writing this as I've got an iBook that is approaching its third birthday this year, and while there doesn't seem to be any major problem with my machine, there are a lot of minor things going wrong with it that concern me. 1. Unless

  • Getting started with Apex

    hi .. I tried to download Apex twice and it downloads a zip(apex_3.2.zip) file everytime that looks like contains documentation... I was expecting some kind of GUI installation (install.exe or setup.exe). As what I need is ..client-db application..I

  • Query Builder in Oracle Application Express

    I am unable to get columns to show after I submitt an object and click "columns" to add for a query. I also cannot get any query at all. Any help out there? Feel free to direct me to correct forum if necessary.