Jar Creation

Hello Guys,
I want a help urgently. I develp some application on Java swing. I put the class files in package concept. For eg. I have login.java and .class files in c:\mani folder and other class files are kept in
c:\mani\pay and c:\mani\rep. Now how can i convert the packages into jar file and how can i convert my login.java to jar and how can i call the files in the packages. Kindly do the needful.
E-mail : [email protected]
With Best Regards,
Ramasubramani.

If jar is in your path change to the "classes" folder at the root of your classpath and type:
jar cvf yourJarNameHere.jar ./
This will create a jar file by decending recursively into the current folder and will include all files.

Similar Messages

  • JAR creation failed , for Command bean DC

    Hi Experts,
    I am trying to access an EJB module DC from WebDynpro through Java bean model DC.
    In this when i tried to create a Jar file of the Java bean model, i got this error.
    JAR creation failed. See details for additional information.
    Problem writing /LocalDevelopmentdc_aptcbsap.com/bin/pg/com/atos/apt/bean/APTCommandBean.class to JAR: duplicate entry: pg/com/atos/apt/bean/APTCommandBean.class
    I have created in all total 4 DC
    1) EJB DC
    2) EAR DC
    3) Java bean DC
    4) WebDynpro DC
    I have reffered to the tutorial : Using EJBs in Web Dynpro application.
    Can you tell me what am i missing?
    Ashish Shah

    Hi Sridhar,
    Thanks for your suggestion.
    I have built and deployed the EAR DC.
    But When I added the following referencesto Java bean DC
    1) EAR DC , EJB DC
    2) ejb20.jar
    and i tried to build java bean DC project, it throws error for these referenced DC.
    And these referenced DCs are removed from the project.
    Do i have to add anything in the Public part of EJB or EAR DC?
    Can you tell me how to add those references in Public part and how to utilise them in other projects?
    Regards,
    Ashish Shah

  • Jar creation from JBuilder file structure

    Hi,
    I've got a program written in jBuilder 4. It does not have the jar creation feature.
    So I've created a jar manually, but I'm having problems finding the main class from the manifest.
    I've created the manifest with no problems:
    Manifest-Version: 1.0
    Main-Class: Application1
    Created-By: me
    Where Application1 is the name of my main class. I've even tried chnging the file path to Application1 such as:
    Main-Class: programfile/classes/programname/Application1
    But whenever I create the jar and double click on it I get an error saying that cannot find main class.
    Does anybody know how to access the main class from a program created in JBuilder???
    Cheers for any help,
    Al

    Cheers for the suggestion, but I managed to sort the problem.
    For anyone else out there who's trying to jar a JBuilder file manually:
    You only need to jar the "class" folder that JBuilder creates for you, not ther entire project. (If you have a file containing images then that will need to be included as well).
    If you've not named your main class the same as the pakage name, then the mane of your main class is packagename.main
    For example if your package is called "Program" and your main class is called "Main" then you need to include the following line in the manifest:
    Main-Class: Program.Main
    Hopes this helps someone.
    Al

  • JAR creation failed. See details for additional information.-invalid header

    Hi
    I am working with 2 databases , 1 is oracle and the other is sybase in my java application.
    The java application gets data from both the databases and creates 3 output files and 1 audit log file .
    Now i tried creating the jar file
    my manifest file looks like this :
    Manifest-Version: 1.0
    Sealed: true
    Main-Class: tableA
    Class-Path:jtds-1.2.jar;classes12.jar ----------------------------> is this correct .
    Now when i try to create the jar file it gives me an err
    JAR creation failed. See details for additional information.-
    invalid header field
    invalid header field
    ANyone pls help me ... I am creating the jar file like rhis
    export -> selecting JAR file -> selecting 1 and 3 rd checkboxes ->location of the jar file -> next->selecting 2 checkboxes in JAR PACKAGING OPTIONS -> ( my question is how to create the manifest file with class-path , their is no option ) so i am creating the manifest file and creating the jar file and then adding the class-path to the manifest file and removing the jar file and recreating the jar file now selecting the manifest file .
    is this giving the above error --> if so how to create the manifest file before creating the jar file with class-path and main class

    Double post: [http://forums.sun.com/thread.jspa?threadID=5358017&messageID=10559776#10559776]

  • Weblogic jar creation in Jbuilder 8

    Hi,
    I have installed Weblogic Server 7.0 and Jbuilder 8. I configure Weblogic as the
    application server, but there is one service (Jar Creation) which is never enabled.
    Why? Isn't it possible to create JAR files for weblogic as I did in Jbuilder 6?
    Should I use any weblogic specific tool for doing so?
    The JAR files I create with Jbuilder8 don't contain the stub and skeleton classes
    I need!!!! In Jbuilder6 it was not necessary to specify a server application for
    every service, just one for all, and it worked fine, generating everything I needed
    in my JAR.
    Help!!!!

    Is there any bea newsgroup for JBuilder, as far as there's a JBuilder Weblogic
    Edition version launched or should I try in Borland's newgroups?
    "Slava Imeshev" <[email protected]> wrote:
    Hi Ignacio,
    I suggest contacting Borland support or posting this question in the
    related
    jbuilder newsgroup.
    Regards,
    Slava Imeshev
    "Ignacio" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    I have installed Weblogic Server 7.0 and Jbuilder 8. I configure Weblogicas the
    application server, but there is one service (Jar Creation) which isnever
    enabled.
    Why? Isn't it possible to create JAR files for weblogic as I did inJbuilder 6?
    Should I use any weblogic specific tool for doing so?
    The JAR files I create with Jbuilder8 don't contain the stub and skeletonclasses
    I need!!!! In Jbuilder6 it was not necessary to specify a serverapplication for
    every service, just one for all, and it worked fine, generating everythingI needed
    in my JAR.
    Help!!!!

  • How to disable application jar creation in tmp folder

    Hi
    I am deploying an application on clustered server.
    Everytime i deploy application a jar(for the application) is getting created in admin server's tmp folder in the folder WLTEMP_APP_DOWNLOADS/<application_name>/<application_name.jar>
    I am deploying application in exploded format and one of its functionality is to generate csv files.
    As Weblogic seems to be referring the application_name.jar I get a 404 error whenever csv files are accessed in UI.
    Could somebody please suggest the settings to disable the application jar creation.

    The issue was with weblogic caching.
    The server was creating a jar of the application in a tmp folder for every deployment .
    Due to this any new file generated within deployment path was not being identified.
    Disabling caching on admin server resolved the issue.

  • Programatic JAR creation

    I am trying to create a JAR file with the java.util.jar library/package.
    I am able to create the file and get files into it but I am unable to access it from a java program.
    If i create the same jar file with the commandline utility i can access it just fine from within a java app. The two jars are identical in their content and structure however they differ in overall size of about 5-10K. Is there something special i need to do to make this jar useable by java? is the API in adequate for this kind of thing? are there any alternatives?
    -ChazZ

    the code for JAR creation:
    "files" is an arraylist i build that consists of paths to the files i wish to put in the jar
                FileInputStream fi = new FileInputStream("." + PATH_SEPARATOR + "MANIFEST.MF");
                Manifest m = new Manifest(fi);
                BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(jarFile));
                JarOutputStream jo = new JarOutputStream(bo, m);
                Object[] f = files.toArray();
                for(int x=0; x<f.length; x++)
                    String act = (String)f[x];
                    BufferedInputStream bi = new BufferedInputStream(new FileInputStream(act));
                     //file paths are too deep in filesys to i strip off the first part of the path
                    JarEntry je = new JarEntry(act.substring(act.lastIndexOf("psdi")));
                    jo.putNextEntry(je);
                    byte[] buf = new byte[1024];
                    int anz = -1;
                    while ((anz = bi.read(buf)) != -1)
                      jo.write(buf, 0, anz);
                    jo.flush();
                    jo.closeEntry();
                    bi.close();
                jo.close();
                bo.close();
            }

  • Jar creation failed

    hi all,
    when i export java project as jar file i got a message[i] jar creation failed
    it's because of duplicate entry: .classpath
    how can i avoid this problem
    Thanks alot

    We're going to need more information to offer any realistic help. Duplicate class path entry where?
    Walk us through your process. For doing build functionality of just about any kind I would recommend learning to use ANT. It will make your life much happier.
    PS.

  • JAR creation failed in Eclipse. error in opening zip file

    When Exporting the project to Runnable JAR file in Eclipse, I have "JAR creation failed", with "error in opening zip file" in details and nothing else.
    I've tried running the new Eclipse environment by starting a new .metadata file. Then, I rebuilt the project - it runs as before.
    What zip file is referred to?

    I imagine it's the "Export destniation" jar/zip. Perhaps it's being
    used by a running application and is therefore locked against writing.
    Have you tried deleting it from the command line?
    [email protected] wrote:
    > When Exporting the project to Runnable JAR file in Eclipse, I have
    > "JAR creation failed", with "error in opening zip file" in details and
    > nothing else.
    >
    > I've tried running the new Eclipse environment by starting a new
    > .metadata file. Then, I rebuilt the project - it runs as before.
    >
    > What zip file is referred to?

  • Classes.jar creation failure in atglib - EAR creation

    Hi All,
    classes.jar (CUSTOMERShop.is-customer) file is not getting generated for custom created module even after importing the classes successfully during ear assembling.
    Please find below the logs for the same. Kindly help to resolve this issue.
    [mvn] [INFO] Assembly started.
    [mvn] [INFO] Target application is C:\projects\CUSTOMER\EARs\CUSTOMERShop.ear.
    [mvn] [INFO] Creating exploded ear file C:\projects\CUSTOMER\EARs\CUSTOMERShop.ear.
    [mvn] [INFO] Initializing...
    [mvn] [INFO] Updating C:\projects\CUSTOMER\EARs\CUSTOMERShop.ear.
    [mvn] [INFO] Before make meta-inf file.
    [mvn] [INFO] Making meta-inf file C:\projects\CUSTOMER\EARs\CUSTOMERShop.ear\META-INF
    [mvn] [INFO] Creating application.xml...
    [mvn] [INFO] Creating Ear file MANIFEST...
    [mvn] [INFO] Importing classes...
    [mvn] [INFO] Importing classes for module DafEar
    [mvn] [INFO] Importing classes for module DafEar.Admin
    [mvn] [INFO] Importing classes for module DafEar.base
    [mvn] [INFO] Importing classes for module CUSTOMERShop.is-customer
    [mvn] [INFO] Importing classes for module CUSTOMERShop.Shop
    [mvn] [INFO] Importing classes for module CUSTOMERShop.commerce-customer.commerce-non-versioned-customer
    [mvn] [INFO] Importing classes for module CUSTOMERShop.commerce-customer
    [mvn] [INFO] Importing classes for module CUSTOMERShop.commerce.commerce-non-versioned
    [mvn] [INFO] Importing classes for module CUSTOMERShop.commerce
    [mvn] [INFO] Importing classes for module CUSTOMERShop.common
    [mvn] [INFO] Importing classes for module CUSTOMERShop.common-generated
    [mvn] [INFO] Importing classes for module B2CCommerce
    [mvn] [INFO] Importing classes for module DCS.AbandonedOrderServices
    [mvn] [INFO] Importing classes for module DCS.PublishingAgent
    [mvn] [INFO] Importing classes for module DCS
    [mvn] [INFO] Importing classes for module PublishingAgent
    [mvn] [INFO] Importing classes for module PublishingAgent.base
    [mvn] [INFO] Importing classes for module REST
    [mvn] [INFO] Importing classes for module DSS
    [mvn] [INFO] Importing classes for module DPS
    [mvn] [INFO] Importing classes for module DAS-UI
    [mvn] [INFO] Importing classes for module DAF.DeploymentAgent
    [mvn] [INFO] Importing classes for module DAS
    [mvn] [INFO] Ignoring classpath entry lib/servlet.jar from module DAS
    [mvn] [INFO] Ignoring classpath entry lib/jsp-api.jar from module DAS
    [mvn] [INFO] Importing classes for module CUSTOMERShop.environment.commerce-development
    [mvn] [INFO] Importing classes for module CUSTOMERShop.environment.licences.dev
    [mvn] [INFO] Importing classes for module CUSTOMERShop.environment.data
    [mvn] [INFO] Importing classes for module CUSTOMERShop.libext
    Regards,
    DKAP

    The logs do not show any errors or info related to that.
    How are you generating the classes.jar for custom module?
    Ear creation or runAssembler will not generate classes.jar. Do you have plugin to compile and create the jar file from the source folder?
    Do you find the classes.jar in the ATG-ClassPath location mentioned in the MANIFEST.MF file?
    Peace
    Shaik

  • Missing something on JAR creation.

    This must be a simple error I'm commiting but it has me stuck on the distribution of my application.
    Even though my app works perfectly on prompt I don't seem to be getting the right works for making the jar file for it.
    My class files are distributed like this :
    Salfoot
    Salfoot/Interface
    Salfoot/Classes
    in the root dir there is only the entry point program that then calls a start frame , etc...
    the following code is contained in this file
    prmSalfoot.java
    import javax.swing.*;
    import Salfoot.Interface.frmLogin;
    public class prmSalfoot
         frmLogin login;
         public static void main(String[] args)
              JFrame login = new frmLogin();
              login.show();
    The manifest file is as follows :
    Manifest-Version: 1.0
    Main-Class: prmSalfoot
    The jar file is generated with the following command :
    jar cmfv manifest salfoot.jar prmSalfoot.class Interface/*.class Classes/*.class
    The following command is how I'm executing the jar file :
    java -jar salfoot.jar
    And the following error is what is outputted :
    Exception in thread "main" java.lang.NoClassDefFoundError: Salfoot/Interface/frmLogin
    What I think is... that the entry-point program is found... but the classes in the packages used are not.
    What special treatment do I need to do with the packages? Is it in the manifest file that I need to make changes? Or should I make separate JAR files for each of the packages and then make a main JAR including the package JARs?
    Thanks for any enlightment.
    Y.S.

    From my understanding you don't need to have all the
    packages in the one jar file.
    The VM builds the class path from the Class-Path attribute
    specified in the manifest file. to specify files outside
    the main jar file set the Class-Path as follows.
    Class-Path: g:\server\Server.jar ..\server\Server2.jar
    this will access classes in the these jar files.
    One thing that I've found with this is that if the
    classes in these external jar files are in packages
    then a class not found error is thrown but if they are
    just classes not in packages this works find. I'm still
    doing some experimenting with this as I've only started
    using jar files.
    Any thoughts?????

  • EJB Client JAR Creation - Workspace Studio (ALSB 3.0/WLS 10)

    hi
    I'm trying to create an EJB Client JAR for an 2.1 Session Bean EJB Created in a WLS 10 domain using BEA Workspace Studio (i.e. this is the Aqualogic Service Bus 3.0 Product install).
    I'm doing this in preparation for testing the ALSB EJB Transport which requires a client JAR.
    I simply can't get a useful JAR from the facility provided in the Workspace IDE. The Workspace help is pointing to an IBM generated page and I'm following the procedure there.
    I have configured the EJB for an EJB Client Project.
    If I export an EAR from the Application containing the EJB, the EAR only contains the EJB JAR (with a Manifest entry to a non-existent Client JAR).
    If I export the EJB Client Project to a JAR the JAR is simply empty i.e. contains some descriptor type artefacts but no classes.
    I have tried this quite a few times with the same outcome. Can anyone from BEA or the user community confirm whether or not this facility actually works!
    Thanks
    Jim Nicolson

    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/ejbTransport/ejbtransport.html#wp1079062 . This is document for OSB 10xx and yours is a a version or two older than this (So it will be applicable).
    Can you please check if your EJB are complying to 2.1specification?
    However the latest version of service has support for both EJB 2.1 and EJB 3.0 specification
    http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15866/ejb.htm#CCGIFFCI
    Thanks
    Manoj

  • Help on JAR creation (newbie)

    Hi guys so I am using Eclipse 3.2 and I click on the project and I say Export to Java --> JAR file
    then I go to prompt and I do java -jar blah.jar and that gives me an error:
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/driver/Or
    acleDriver
            at Driver.main(Driver.java:81)I know why I am getting this. Because I am using the JDBC in my code and there's another jar file that does that its actually called: ojdbc14.jar
    So the question is what do I do. I just want to run this project without having to run Eclipse. If there's any other way I can run this project besides JAR and Eclipse, oh and just typing java Driver doesn't work either so.
    Any help would be appreciated.

    Simplest would be use of java with the -cp option. something like java -cp blah.jar;jdbc.jar MainClassOtherwise, you should be able to use the Class-Path attribute of the manifest to specify a relative path to the jdbc jar.

  • Help with JAR creation please

    I've created a JAVA program with the Forte IDE and now I want to make it executable without the IDE. I read on this forum that all I had to do was create a JAR file, so I tried but I get an error (see below). Could someone point out my error please.
    Also, I tried to run the jar command by itself, I received a command not found error. Only when I preceeded the jar command by JAVA (i.e. JAVA -jar ....) did DOS attempt to run the command.
    Second request: Am I missing the path to the jar command in my path variable?
    Directory Tree:
    vio082\vio\app\
    DOS command to create executable JAR:
    "java -jar cmf trackerManifest.txt trackerTest.jar trackerTest.Class"
    ERROR I RECEIVED:
    "Exception in thread "main" java.util.zip.ZipException: The system cannot find the file specified
    at java.util.zip.ZipFile.open<Native Method>
    at java.util.zip.ZipFile.<init><Unknown Source>
    at java.util.zip.ZipFile.<init><Unknown Source>
    at java.util.zip.ZipFile.<init><Unknown Source>"
    This was my file trackerManifest.txt:
    Main Class: trackerTest
    [cr]
    This is the begining of my file trackerTest.Class:
    package vio.app;
    import javax.comm.*;
    import vio.tracker.*;
    import java.net.*;
    import java.io.*;
    public class trackerTest {
    public static void main (String argv[]) {

    Hi there,
    I'd like to get in on this as well ... I've got a problem of my own with this. In the past I've created packages and ran them alright. And I create my own .jar files all the time on MS Win OS's, which I distribute for others and create desktop shortcuts for, etc. ... no problems; I sometimes jar up applications in unix, even though pretty much everything I run there is command line, just to keep things together.
    But I've never jar'd up an application with my OWN packages inside, rather than just the default directory path (IOW: with package statements) and now that I'm trying it's not working quite right ... here's the deal:
    Here's the path to the 1st package level: C:\MyMoveSubDir\Mysendrecv\Billsdir\TestPgms
    Here's the next dir level:
    mytestdir
    So, in C:\MyMoveSubDir\Mysendrecv\Billsdir\TestPgms\mytestdir is:
    TestClassy.class
    and
    TestClassy$P1.class
    ... created from:
    TestClassy.java ... the source is:
    package mytestdir;
    public class TestClassy {
    public static final void doNothing() {
    System.out.println("What a doNothing method");
    protected class P1 {
    void afancymethod() {
    System.out.println("What a fancy method");
    public static void main(String[] argv) {
    TestClassy tc = new TestClassy();
    tc.doNothing();
    P1 p1 = tc.new P1();
    p1.afancymethod();
    ... The manifest file is called mymanifest.txt, and is in:
    C:\MyMoveSubDir\Mysendrecv\Billsdir\TestPgms, and looks like this:
    Main-Class: mytestdir.TestClassy
    I compile the pgm from C:\MyMoveSubDir\Mysendrecv\Billsdir\TestPgms like this:
    javac -classpath . mytestdir\TestClassy.java
    I run the pgm from same like this:
    java -classpath . mytestdir/TestClassy
    ... and it prints:
    What a doNothing method
    What a fancy method
    ...fine.
    I can jar it up like this:
    C:\MYMOVE~1\MYSEND~1\Billsdir\TestPgms>jar cvfm TestClassyJar.jar mymanifest.txt -C mytestdir/ .
    added manifest
    adding: mytestdir/./(in = 0) (out= 0)(stored 0%)
    adding: mytestdir/./TestClassy$P1.class(in = 594) (out= 374)(deflated 37%)
    adding: mytestdir/./TestClassy.class(in = 681) (out= 436)(deflated 35%)
    adding: mytestdir/./TestClassy.java(in = 423) (out= 214)(deflated 49%)
    But no matter how I try to execute it - like this - it fails with:
    C:\MYMOVE~1\MYSEND~1\Billsdir\TestPgms>java -jar TestClassyJar.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: mytestdir/TestClassy
    ... any suggestions anyone. I'd sure appreciate it.
    ~Bill

  • Need a little help with JAR creation

    I've created a JAVA program with the Forte IDE and now I want to make it executable without the IDE. I read on this forum that all I had to do was create a JAR file, so I tried but I get an error (see below). Could someone point out my error please.
    Directory Tree:
    vio082\vio\app\
    DOS command to create executable JAR:
    "java -jar cmf trackerManifest.txt trackerTest.jar trackerTest.Class"
    ERROR I RECEIVED:
    "Exception in thread "main" java.util.zip.ZipException: The system cannot find the file specified
         at java.util.zip.ZipFile.open<Native Method>
         at java.util.zip.ZipFile.<init><Unknown Source>
         at java.util.zip.ZipFile.<init><Unknown Source>
         at java.util.zip.ZipFile.<init><Unknown Source>"
    This was my file trackerManifest.txt:
    Main Class: trackerTest
    [cr]
    This is the begining of my file trackerTest.Class:
    package vio.app;
    import javax.comm.*;
    import vio.tracker.*;
    import java.net.*;
    import java.io.*;
    public class trackerTest {
         public static void main (String argv[]) {

    Thanks for the help so far. My first problem was that the directory with the "jar" command was not in my path (now that fixed). My application still won't execute and I think it has to do with the following:
    My application uses the serial port to communicate with a device and uses a socket server to communicate with a C++ program. The following JAVA utilities are imported to make my application work:
    javax.comm.
    java.net.
    ijava.io.
    If I use the command:
    "jar cvfm trackerTest.jar trackerManifest.txt trackerTest.Class"
    will the appropriate files from javax.comm, java.net and ijava.io also be incorporated into the jar file? If not, how are they made available when I distribute my jar to other users?
    Second question:
    Should I be using:
    "jar cvfm trackerTest.jar trackerManifest.txt vio082/*.*"
    to capture all the other classes required by my package that are in other directories above and below the trackerTest.class directory?
    Any help is greatly appreciated.
    JAM

Maybe you are looking for