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.

Similar Messages

  • 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

  • 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

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

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

  • Help using jar file!

    Help using jar file!
    Hello
    I have created a jar file by using
    jar cvmf Manifest.txt myjar.jar 1.class Mydirectory
    In 1.java file :I have used
    JEditorPane editor;
    editor.setPage(getClass().getResource("/Mydirectory/default.htm"));
    If I am only giving myjar.jar file to the client without Mydirectory then also it is working fine by showing default.htm in JeditorPane.
    But my problem is I want to use
    Runtime.getRuntime().exec("cmd /c start IEXPLORE"+targetstr) ;
    targetstr will be the filename with path of the default.htm
    If I am giving myjar.jar file with Mydirectory to the client it is working but I don't want to give Mydirectory to the client .
    What should I do?
    Is there any solution for this?
    Using another jar file which will include mydirectory can solve this problem?
    Is there any othe concept in java so that I wll be able to hide Mydirectory from client?
    Please help.

    It seems like you could extract the .htm file from the jar, either with Runtime.exec or using the Jar API classes.

  • 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

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

  • Help!!! Newbie here!

    Alright. I have CS3 and am 'trying' to get used to it. I am trying to do a vintage effect and of course this takes many steps. One of the steps (almost one of the lasts) is to go to Filter>Distort>Lens Correction AND then from there, use the Vignette Slider, etc...
    Well, Under MY Filter, there is NO distort, there was in my CS2, so I dunno what the deal is. I used the Help Search and it found the distort under the Edit>Transform>Distort. BUT, the distort is greyed out! I have tried everything. It IS in 8 bit, I've even tried 16 bit... NOT working. The only time distort even comes up is if I go to another 'blank' layer... and of course, I can't do anything with it! :(
    so, what do i need to do to get the distort working... it's there, but it's greyed out. Please help. And I don't know if this will give my email or not, please feel free to email me also with your help! :D thanks!
    [email address deleted]
    A*

    Andrea,
    >Help!!! Newbie here!
    I know you're new here, and I'd like to welcome you to this forum. However, please understand that (in addition to the previous posts here), a generic "HELP!!!" subject line won't bring you responses: Folks scanning the topics have no idea what the problem is, and even if they may have an answer, they may not bother to click on the generic topic, read it and post.
    As a Forum Host, I can change your topic subject line to be more useful and drive more traffic to it, if you wish. Please post back how you'd like to change it.
    Neil

  • Schedule line Release with help of release creation profile.

    Hello,
    Is it possible to create the schedule line release for scehule line automaticaly by heuristcs run with the help of release creation profile of external procurement relationship ?
    We can release the schedule line in product view.
    What is other way release the schedule line?

    Hi,
    Credit check is done to see if the customer has crossed his credit limit or not. Incase you want to forcefully release order we use [VKM1]. What is this got to do with the schedule lines??? Irrespective of whether the order is under credit hold or no the schedule line are determined the same way. Didnt understand the connection.
    Regards
    Nadarajah Pratheb

  • Help in understanding creation of a jar file

    Hi,
    Could anyone explain what this (in), (out), and (deflated ) and (stored) means wrt the creation of a jar
    For Ex:
    adding: com/(in = 0) (out= 0)(stored 0%)
    adding: com/test/(in = 0) (out= 0)(stored 0%)
    adding: com/test/teststubs/(in = 0) (out= 0)(stored 0%)
    adding: com/test/teststubs/TestLoader.class(in = 8029) (out= 4248)(deflated 47%)
    TIA

    I believe it's all about compression. "in" and "out" are the bytes added before and after compression. "deflated" is the compression method, and the percentage is the amount of compression achieved.
    The first three things added in your example are directories, so they weren't added directly; rather the ZIP mechanism for expressing file hierarchies was used (as opposed to actually adding the directory file from the disk).

Maybe you are looking for

  • Add blank values to datefield

    hi Please help. I am trying to put blank spaces for values which are NULL in a datetime field eg 2013-12-31 2013-11-30 NULL 2013-09-28 Expected result is  take out the null and replace blank space. I need this in datetime format to export in to excel

  • ITunes not opening with windows 7

    iTunes has stopped working on my sony laptop. I have uninstaed all aspects and reloaded. When you click the shortcut or from main menu nothing happens. Whe you look at properties iTunes is now not compatiable !!!what is going on ! Please please help

  • Data Forms in Smart View - Add Members

    We have data forms with Add Member functionality. When opening that data form using Smart View it puts red border around top member but then instead of allowing user to select a member it lists all of them in the rows. A good example is ICP data form

  • My Laserjet 5550 is stuck in "offline" mode.

    How can I bring this device back on line? Two computers - a PC and a laptop - both show this printer as offline. This has happened several times over the past three years and the only fix I've found is to reinstall the full driver. There must be a si

  • Compression Algorithm (LZW,RLE,Hoffman) implemnation code for free

    this file contain java implemntation of lzw and run length and hoffman compression technique for compression text file : to run unzip project.zip and run using java sun one stdio or use dose the main window using: C:\java JFrame_1 enter the name of t