JAR and UNJAR

I don't know how to JAR, UNJAR a file?why we are using this technique?I need more information about this.

As the fellow posters mentiioned, a JAR file is an archive holding all your application data.
As a big advantage, dou dont need to cope with several classpaths to set or access problems regarding resources spread in your file systems
You can just call your app with the java -jar option to run it.
Additionally, trust establishment with jars is only possible (and easier) using jar files.
If you are writing applets you can put everything inside the jar file withtout the need for classpath or codebase problem related to it, the applet is loaded as a whole instead of loading lots of scattered class files. Though this does prevent from loading class files on demand only, the overall loading process is much faster.
Summarizing, using jar files makes software deployment much easier.
Oliver

Similar Messages

  • Jarring and unjarring files at runtime.

    I have this line
    Runtime.getRuntime().exec("jar -x foo.jar");which hangs.
    I wanted to dynamically jar and unjar files.. Can I do this with Runtime.exec()?

    Umm..
    It took some fiddling for me to realize that I have to have my class file in the directory where I want the extracted files to be for those files to be unjarred in the right place, which then created this problem during rejarring, where my class file gets jarred into it... how can I
    a) exclude my class file from being jarred? OR
    b) remove auto.class after the jar file is created?
    If I knew it was this much of a pain, I would've done it manually :D

  • What is the diffrence b/w jar and ear?

    what is the diffrence b/w jar and ear?

    Refer this
    http://forum.java.sun.com/thread.jspa?threadID=779900&tstart=0
    Regards
    lekshmi

  • Loading .jar and .class in MX7

    I have a cfx tag that includes a .class and .jar file. I
    could do this on the old MX server but in MX7 the option is not in
    the cfide/administrator.
    I copied the .jar and .class files into the
    c:\cfusionmx7\runtime\lib\ directory and then added them to the
    bottom of the jvm.config file with the following entry. (note: The
    .jar file is called MYNEWFILE.jar)
    java.class.path={application.home}/servers/lib,{application.home}/../lib/macromedia_driver s.jar,{application.home}/lib/cfmx_mbean.jar,{application.home}/lib,{application.home}/lib/ MYNEWFILE.jar,{application.home}/../wwwroot/WEB-INF/lib/
    I then rebooted the server. I also have a ".class" file that
    goes with this. I have no idea where to put that thing. The cfx
    (which I mapped in the administrator).
    I get the standard 500 error saying:
    HTTP 500 - Internal server error
    Internet Explorer
    even though I have debugging going to my laptop.
    Here is the output of the exception.log
    "Error","jrpp-0","07/05/07","16:04:14",,"com/allaire/cfx/CustomTag
    The specific sequence of files included or processed is:
    C:\Inetpub\wwwroot\Pauly\example.cfm "
    java.lang.NoClassDefFoundError: com/allaire/cfx/CustomTag
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown
    Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at
    jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:77)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at
    jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:77)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at
    jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:77)
    at
    jrunx.util.JRunURLClassLoader.loadClass(JRunURLClassLoader.java:69)
    at
    coldfusion.bootstrap.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:207)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at coldfusion.tagext.CfxTag.doStartTag(CfxTag.java:88)
    at
    coldfusion.runtime.CfJspPage._emptyTag(CfJspPage.java:1908)
    at
    cfexample2ecfm2026642798.runPage(C:\Inetpub\wwwroot\Pauly\example.cfm:3)
    at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
    at
    coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:343)
    at
    coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
    at
    coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:210)
    at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
    at
    coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:50)
    at
    coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52)
    at
    coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)
    at
    coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
    at
    coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
    at
    coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
    at coldfusion.CfmServlet.service(CfmServlet.java:105)
    at
    coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
    at
    jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:349)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:457)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:295)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    "Information","Thread-10","07/05/07","16:14:10",,"Address
    already in use: JVM_Bind"
    java.net.BindException: Address already in use: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at
    coldfusion.server.jrun4.metrics.CfstatServer.run(CfstatServer.java:64)
    Any help would be greatly appreciated, as I've been working
    on this for a while. I couldn't find a solution in the forums so I
    thought I would post. Thanks!
    Pauly

    >> java.lang.NoClassDefFoundError:
    com/allaire/cfx/CustomTag
    Is the CFX.jar in the classpath?
    > The option is not in the cfide/administrator.
    What option? The administrator has several options for custom
    jars, tags, et.
    - Extensions -> Custom Tag Paths
    - Extensions -> CFX Tags
    CF will also look in these directories automatically
    - {cf_webroot}/WEB-INF/classes (for classes)
    - {cf_webroot}/WEB-INF/lib (for jars)

  • Adding a jar to the classpath of an executable jar (mixing -jar and -cp)

    Hello,
    frankly I hesitated over posting this to "New to Java"; my apologies (but also, eternal gratefulness) if there is an ultra-simple answer I have overlooked...
    I integrate a black-box app (I'm not supposed to have the source) that comes packaged as an executable jar (with a Manifest.MF that specifies the main class and a bunch of dependent jars), along with a few dependent jars and a startup script. Long story short, the application code supports adding jars in the classpath, but I can't find a painless way to add a jar in its "classpath".
    The app's "vendor" (another department of my customer company) has a slow turnaround on support requests, so while waiting for their suggestion as to how exactly to integrate custom jars, I'm trying to find a solution at the pure Java level.
    The startup script features a "just run the jar" launch line:
    java -jar startup.jarI tried tweaking this line to add a custom jar in the classpath
    java -cp mycustomclasses.jar -jar startup.jarBut that didn't seem to work ( NoClassDefFound at the point where the extension class is supposed to be loaded).
    I tried various combination of order, -cp/-classpath, using the CLASSPATH environment variable,... and eventually gave up and devised a manual launch line, which obviously worked:
    java -cp startup.jar;dependency1.jar;dependency2.jar;mycustomclasses.jar fully.qualified.name.of.StartupClassI resent this approach though, which not only makes me have to know the main class of the app, but also forces me to specify all the dependencies explicitly (the whole content of the Manifest's class-path entry).
    I'm surprised there isn't another approach: really, can't I mix -jar and -cp options?
    - [url http://download.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html]This document (apparently a bible on the CLASSPATH), pointed out by a repited forum member recently, does not document the -jar option.
    - the [url http://download.oracle.com/javase/tutorial/deployment/jar/run.html]Java tutorial describes how to use the -jar option, but does not mention how it could play along with -cp
    Thanks in advance, and best regards,
    J.
    Edited by: jduprez on Dec 7, 2010 11:35 PM
    Ahem, the "Java application launcher" page bundled with the JDK doc (http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html) specifies that +When you use [the -jar] option, the JAR file is the source of all user classes, and other user class path settings are ignored+
    So this behavior is deliberate indeed... my chances diminish to find a way around other than specifying the full classpath and main class...

    I would have thought that the main-class attribute of the JAR you name in the -jar option is the one that is executed.Then I still have the burden of copying that from the initial startup.jar's manifest. Slightly less annoying than copying the whole Class-path entry, but it's an impediment to integrating it as a "black-box".
    The 'cascading' behavior is implicit in the specification
    I know at least one regular in addition to me that would issue some irony about putting those terms together :o)
    Anyway, thank you for confirming the original issue, and merci beaucoup for your handy "wrapper" trick.
    I'll revisit the post markers once I've actually tried it.
    Best regards,
    Jérôme

  • How to install the struts-el jar and tld file

    How can i install/configure the struts-el jar and struts-logic-el.tld. When I tried with the related sites, i couldn't get any jar files for struts-el tag.
    I got only 404 status error.
    From where and how to get the jar file and tld file for the struts-el tag .Please refer me

    The jar file is part of the download of struts.
    its in the /contrib/lib directory
    You should need struts, jstl plus the struts-el jar files.
    The tld files should not be necessary - just use the standard URIs for them.
    eg http://struts.apache.org/tags-logic-el

  • Peculiar issue with signed .jars and Linux (Debian unstable, 2.4.20-custom)

    BACKGROUND:
    I am a developer working on a Java3D application, which is to be deliverable over
    the Web. Delivery as an applet seemed a natural choice, and so I spent a considerable amount of effort learning (I won't say "mastering") the process of
    creating a self-signed .jar containing java3d-<some_version>.exe. I have in fact
    successfully created a fully-fuctional from-scratch JPI/Java3D/myapp install. By
    this I mean that Windows machine with only stock IE installed could hit my URL,
    get the proper JPI installed, followed by the Java3D runtime I'd chosen, as well
    as a third-party DXF loader, and finally (after much clicking of 'Yes', 'Accept',
    'OK', etc.) see my app in a browser window.
    That was on my old, slow, Windows2000 workstation. Now I have a shiny, new
    workstation upon which my employer has graciously allowed me to run Linux. Sadly,
    the re-creation of the self-signed .jar files under a new JDK has not gone smoothly.
    PROBLEM DESCRIPTION:
    When a user attempts to download the self-signed .jar containing the auto-install
    executable for the Java3D runtime, the normal security warning prompts are displayed (one for granting to install the extension, one to accept the "suspect" certificate from me alone). The plugin happily downloads the .jar file, and then
    a NullPointerException is thrown, with a
    stack trace like:
    NPE!
    at java.util.zip.ZipFile.getInputStream (unknown source)
    at java.util.jar.JarFile.getInputStream (unknown source)
    <something>doPrivileged<something>
    etc.
    I apologize for the lack of a full stack trace; I would essentially have to type it in by hand after printing it out on the remote test box; I hope that I've caught the important details above.
    After this, the pure-java signed .jar is downloaded and installed, and then the applet "loads" with the predictable ClassNotFoundException for javax.media.j3d.SceneGroup.
    Downloading and installing the J3D runtime by hand and then re-visiting the URL results in a fully-functional applet.
    I've tried Blackdown Linux JDKs 1.4 and 1.3.1, as well as Sun's JDKs 1.3.1_07 and 1.3.1_05 for the compiling, jar'ing, and jarsigner'ing of these files, all with the same result. At each new JDK, I re-did the HTML conversion so that he appropriate
    JPI version was required on the client. I did complete uninstallations of all client JPI instances (including Web Start for 1.4.1_x, as well as cleaning the registry on the client).
    When this strategy worked, it was on Sun JDK 1.3.1_05 for Windows runnning on Windows2000, unknown service pack.
    DESIRED BEHAVIOR:
    I would like my clients to be able to go from stock Windows2K/IE (this being an intranet without any other options) to some JPI version running the J3D extension, with only the need to click 'OK', 'Accept', 'Grant This Session', etc. a bunch of times on the part of the user. I want this to happen without my having to resurrect my decrepit old Compaq Deskpro just to play the role of "build host" for my
    Java3D and loader .jar files, if at all possible.
    FILES:
    Here's what gets merged into the "main" applet's mainfest at creation time:
    Manifest-Version: 1.0
    Extension-List: java3d DxfLoader
    java3d-Extension-Name: javax.media.j3d
    java3d-Implementation-Vendor-Id: com.sun
    java3d-Implementation-Version: 1.3
    java3d-Specification-Title: Java 3D API Specification
    java3d-Specification-Version: 1.3
    java3d-Specification-Vendor: Sun Microsystems, Inc
    java3d-Implementation-URL: http://10.1.1.1/heartcad/lib/java3d.jar
    DxfLoader-Extension-Name: eupla.dxfloader
    DxfLoader-Implementation-Title: Eupla DXFLoader
    DXFLoader-Implementation-URL: http://10.1.1.1/heartcad/lib/DxfLoader.jar
    And into the manifest for the J3D .jar:
    Manifest-Version: 1.0
    Implementation-Version: 1.3
    Specification-Version: 1.3
    Extension-Installation: "java3d-1_3-windows-i586-directx-rt.exe"
    Extension-Name: javax.media.j3d
    Implementation-Vendor-Id: com.sun
    Implementation-Vendor: Sun Microsystems, Inc
    Specification-Vendor: Sun Microsystems, Inc

    I have seen that bug, and the problem I'm having seems to be different than it. The extension installer is in the first extension .jar my applet asks for, and it
    never works automatically, regardless of how many times the applet is loaded.
    The second .jar, which doesn't have to run any installer, always works fine, but the first one will never work (a manual install of the Java3D runtime is required). This seems to not be the behavior described in the bug.
    I will continue to search for an answer to this problem, and of course if I should find anything I'll post it here.

  • Problem may be with saaj.jar and AXIS,WAS,WSAD

    Hi,
    I have successfully developed and deployed an EJB using WSAD 5.1.2's WebSphere 5.0 Test Environment. I have even able to access the EJB using UTC(Universal Test Client) in WSAD and by launching the j2ee client module using
    WebSphere lauchClient program.
    Basically I have below directory structure:
    a.ear
    --|-----axis.war
    -----------|------ lib
    --------------------|--- all axis related jars are here
    --|-----demoEjb.jar (has java jar dependencies set to axis.war\lib jars
    I have now exposed this ejb as web service using AXIS 1.2 RC2 deployed as web module inside WSAD. This web service is properly exposed as web service as I can see it and access its wsdl when I access axis web services.
    Now I have written a standalone-outside-wsad web service client that uses AXIS stubs and when I try to consume to this ejb web service I am getting below error.
    AxisFault
    faultCode: {http://xml.apache.org/axis/}HTTP
    faultSubcode:
    faultString: (500)Internal Server Error
    faultActor:
    faultNode:
    faultDetail:
    {}:return code: 500
    Error 500: class org.apache.axis.SOAPPart does not implement interface org.w3c.dom.Document
    {http://xml.apache.org/axis/}HttpErrorCode:500
    (500)Internal Server Error
    at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:663)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:94)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
    at org.apache.axis.client.Call.invoke(Call.java:2702)
    at org.apache.axis.client.Call.invoke(Call.java:2378)
    at org.apache.axis.client.Call.invoke(Call.java:2301)
    at org.apache.axis.client.Call.invoke(Call.java:1758)
    at com.sosnoski.test.DemoBindingStub.getAccountHistory(DemoBindingStub.java:194)
    at com.sosnoski.test.Client.query(Client.java:63)
    at com.sosnoski.test.Client.main(Client.java:100)
    I read somewhere with axis mailing lists that it is problem related to axis's saaj.jar and wsad's websphere 5.0
    test environment's webservices.jar so I even replaced my wsad installation's D:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v5\lib\webservices.jar with
    saaj.jar but this did not help and even I have added an references to saaj.jar usign wsad's websphere 5.0 test environment
    environment tab->ws.ext.dirs property and even this did not help.
    Can anyone please tell me why is error occurring and how to solve it ?
    Thanks & Regards,
    Kumar.

    Yes :-)
    At the ear level, set the Classloader mode to PARENT_FIRST and WAR classloader policy to APPLICATION. At the axis web module level, set the Classloader mode to PARENT_LAST
    We can colloborate to our future efforts if you can please give your active personal id from which you can respond faster for queries ....

  • Load Jar and access a class in jar at run time

    I need help from you.
    How to load a Jar and access a class in the jar at run time?
    When i try the following code it works fine while running in Java (Jdk1.5).If iam running the same code in servlet,ClassCastException occurs.
    Error Message : ClassCastExcption : jartest1 cannot be cast to Thing
    test.jar contains jartest.class and Thing.class
    jartest1.java
    try{
    File file =new File("test.jar");
    String lcStr ="jartest";
    URL jfile = new URL("jar", "", "file:" + file.getAbsolutePath() +"!/");
    URLClassLoader cl = URLClassLoader.newInstance(new URL[] { jfile });
    Class loadedClass = cl.loadClass(lcStr);
    Thing t=(Thing)loadedClass.newInstance();
    t.execute();
    catch(Exception e)
    System.err.println(e);
    Thing.java
    public interface Thing
    void execute();
    jartest.java
    public class jartest implements Thing
    public void exceute()
    System.out.println("Welcome");
    Thanks and Regards
    V.Senthil Kumar
    Edited by: senthilv_sun on Dec 16, 2008 8:30 PM

    senthilv_sun wrote:
    I need help from you.
    How to load a Jar and access a class in the jar at run time?
    When i try the following code it works fine while running in Java (Jdk1.5).If iam running the same code in servlet,ClassCastException occurs.
    Error Message : ClassCastExcption : jartest1 cannot be cast to ThingPresumably we can only hope that that is a transciption error. It always helps to use copy and past actual errors and code rather than manually typing them.
    test.jar contains jartest.class and Thing.classWrong.
    The interface class and plugable class must not be in the same jar.
    A plugable interface requires two components
    - Interface (generic sense)
    - Functional components.
    The Interface must be independant (own jar) so that it is available to the framework (user of plugin) and to the functional components. And the plugable component must not be on the java class path.
    This also means that we know for certain that the plugable component is also on the system class path. That is a bad idea as well.
    Given that it is pretty pointless to even speculate as to why this error is showing up. Create the correct jar layout. Test using the command line. Then test using servlets. Insure that the plugable jar is NOT on the java classpath for both tests.

  • Java - referencing external jar and class files

    When compiling (loadjava) a Java class, how can an externally referenced '.jar file' be resolved please? Using '-resolve' doesn't do the job in this case.
    Many thanks.

    I think I've seen an option for this with manifest files (or was it something that had to do with the java plug-in). There was something about the version and only download a new version if it was newer than the one on your local computer. This version thing is something you define in the manifest file at least. Take a look at jar and manifest files, there might be something there.

  • Standard.jar and jstl.jar directory

    First off I probably should apologize in advance because my problem might be an eclipse config issue.
    I created a simple servlet and I tried to include a jstl library import javax.servlet.jsp.jstl.sql.Result;. It compiled cleanly but, when I ran the application (through a browser accessing tomcat through eclipse) I was getting this error...
    The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    I eventually found out what was wrong but I don't understand why it was wrong and that's my question. Originally I had jstl.jar and standard.jar in the projectHome/lib directory. When I moved those 2 files to the projectHome]/WEB-INF/lib directory, however, things ran correctly. Is this a setting somewhere within my tomcat config on eclipse perhaps? Or can someone point me in the right direction about this issue in general?
    Thanks in advance!

    Tomcat and Eclipse have different ideas of classpath.
    In Eclipse you set the classpath as part of the project properties: Java Build Path.
    Tomcat uses:
    - web-inf/classes directory
    - jar files in web-inf/lib
    - jar files in /shared/lib
    - jar files in /common/lib
    So in order to run on Tomcat, they need to be in the web-inf/lib directory.
    Cheers,
    evnafets

  • Ears, wars, support jars, and CLASSPATH

    I am trying to migrate an application from WLS 5.1 to 6.1. There are 25
    EJB jars with an equal number of support jars, most of which are referenced
    by multiple EJBs. There are also a large number of jsps, and html pages.
    I have tried packaging an ear that contains the 25 ejb jars, a war file
    containing the web pages. I have attempted to include the support jars in
    the ear as well.
    In all attempts, the only way I get class references sastisfied is to
    include all the jars on the system CLASSPATH. But this defeats the purpose
    of packaging, since none of the components referenced in the system
    CLASSPATH will be re-deployable.
    The online documents refer to separate class loaders and classpaths for the
    war and ejbs, but no detail as to how classes are found by the loaders.
    Unless I put all the jars into the CLASSPATH, jsp pages cannot reference the
    EJBs, and EJBs are unable to reference other EJBs.

    Thanks,
    Now if I could just get Webgain Visual Cafe to allow me to include the
    Classpath entries in the generated manifests for the EJB jars.
    "Gregory Gerard" <[email protected]> wrote in message
    news:3ba24da1$[email protected]..
    You need to mangle all the Manifest files within the EAR and EJB-JARs and
    WAR to get the right thing to happen. Check out this PDF on Sun's site:
    http://java.sun.com/j2ee/j2ee-1_3-pfd4-spec.pdf
    section 8.1.1.2
    I don't entirely understand all the restrictions and formatting -- Ihaven't
    found an example ear file out there that implements a non-trivial case.
    greg
    "Carl Lawstuen" <[email protected]> wrote in message
    news:3ba21d8e$[email protected]..
    I am trying to migrate an application from WLS 5.1 to 6.1. There are
    25
    EJB jars with an equal number of support jars, most of which arereferenced
    by multiple EJBs. There are also a large number of jsps, and htmlpages.
    I have tried packaging an ear that contains the 25 ejb jars, a war file
    containing the web pages. I have attempted to include the support jarsin
    the ear as well.
    In all attempts, the only way I get class references sastisfied is to
    include all the jars on the system CLASSPATH. But this defeats thepurpose
    of packaging, since none of the components referenced in the system
    CLASSPATH will be re-deployable.
    The online documents refer to separate class loaders and classpaths forthe
    war and ejbs, but no detail as to how classes are found by the loaders.
    Unless I put all the jars into the CLASSPATH, jsp pages cannot referencethe
    EJBs, and EJBs are unable to reference other EJBs.

  • Jars and classpath

    Hi All,
    I have a command line program which access database and somehow connects to a servlet running in Tomcat.
    Originally, the root directory has 2 sub-directories: the classes and the lib. The classes directory contains config files, like database name, port no... The lib dir contains all the jar files needed by my program to run.
    Honestly, it run using: java -cp /path/to/dir/jar1.jar;/path/to/dir/jar2.jar,....
    But the program uses many jar files, more or less 20 jar files, and many config files. And Its not convenient to run the program using the command above.
    So, I made a manifest file, manifest.mnf, and saved it under the classes dir:
    Manifest-Version: 1.0
    Main-Class: ManualSend
    Class-Path: ..\lib\bsiclient.jar
    ..\lib\msh.jar
    ..\classes\dbojects.properties
    ..\classes\config.xml
    ..\classes\jndi.properties
    ..\classes\log4j.properties
    ..\classes\msh_client.properties.xml
    ..\classes\sql.properties
    ..\lib\activation.jar
    ..\lib\avalon-framework-4.1.4.jar
    ..\lib\batik.jar
    ..\lib\bsi.jar
    ..\lib\bcmail-jdk13-115.jar
    ..\lib\commons-beanutils.jar
    ..\lib\commons-codec-1.2.jar
    ..\lib\commons-collections-3.1.jar
    ..\lib\commons-logging.jar
    ..\lib\commons-configuration-1.0.jar
    ..\lib\commons-digester.jar
    ..\lib\commons-lang-2.0.jar
    ..\lib\cos.jar lib\dom.jar
    ....etc.
    The ManualSend class is in bsiclient.jar. It used the default package.
    I run it in classes dir: jar -cvfm test.jar
    java -jar test.jar
    I got an error, saying:
    Error in building: \classes\test.jar!\msh_client.properties.xml (The filename, directory name, or volume label sntax is incorrect).
    I can't figure it out, so for the meantime, i just changed the '..\classes\' part of my manifest to '.\'
    I'm not happy with that. I want it to run from my root directory, using /lib and /classes subdirectories.
    Is there a way to do that? Really i'm confused with these classpath thing.
    Please, any comments, opinions, suggestions.... even violent reactions are greatly appreciated. I haven't received any feedbacks with any of my previous post in all of forums.
    Thanks,

    thanks Peter,
    I've attempted that approach before. But as i've said my program needs a lot of jar files, plus a number of config files. If i write them on one single Class-Path line, i got an error saying 'commands too long lines', or something like that.
    The manifest works fine. I am able to run the program using that manifest. But I'm not happy with that. Actually the program was based on a Tomcat webapp. I am actually doing a command-line version of it.
    So it Tomcat WEB-INF, classes and lib directories were separated. I am looking for a way to use these 2 separate directories. What I would like to find out is how to run my program, outside of the WEB-INF classes and lib directories, and at the same time could access all the jars and config files in them.
    As of the moment I had no luck of doing that. I had to run the program inside classes folder, and make a copy of lib folder inside the classes folder.
    Do you have any more suggestions, opinions? Please.

  • Java classes in Jar and Cab files

    Hello all,
    Our product supply java classes in Jar and Cab files that the browser downloads each time.
    The files are big and it takes a long time.
    Do you know of a way to make the cab/jar files be copied in to the user computer and that the browser would know to download files again only if there is a new version (otherwise take it from the local computer)
    Please help me
    Tamg

    I think I've seen an option for this with manifest files (or was it something that had to do with the java plug-in). There was something about the version and only download a new version if it was newer than the one on your local computer. This version thing is something you define in the manifest file at least. Take a look at jar and manifest files, there might be something there.

  • Java Jars And Packages

    I was just wondering if there was a way to create a jar file containing a custom library of classes that you could import packages from? I know you can setup a jar so that it will automatically run a program when you double click it - but is there a way to import files from it? I've tried looking up the tutorials on it on the Sun website - but I couldn't find anything directly on this question.

    csuguy wrote:
    I was just wondering if there was a way to create a jar file containing a custom library of classes that you could import packages from? I know you can setup a jar so that it will automatically run a program when you double click it - but is there a way to import files from it? I've tried looking up the tutorials on it on the Sun website - but I couldn't find anything directly on this question.The only difference between a class library jar and an executable jar is the latter has a "Main-Class" property in the manifest.
    However, note that if you use a library jar from an executable jar you need the path to the library jar in the Class-Path: property of the executable's jar's manifest, command line or environmental class path is ignored for executable jars.

Maybe you are looking for