Application won't work as JAR file

Hello all,
I am new to java and just wrote my first java program today. I finally got it compiled and working. I have no problems running the application from the command line when the application is not JARred up. When I JAR is up, the application will launch, but the one function it is supposed to excute doesn't work anymore. I created the JAR file with a main class definition in the manifest file.
The error the console is spitting out when the action executes is this:
Exception occurred during event dispatching:
java.lang.NoClassDefFoundError: lotus/domino/NotesException
Now, this appears to be not finding one of my imported classes, but I have my classpath set to include the package. It works fine when the app is not a JAR, but when it is I get the above error.
Can anyone point me in the right direction?
Thanks in advance!
_george                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Executable jar files do not use the classpath, at least they don't use the CLASSPATH environment variable. (I assume that's what you are referring to when you say "I have my classpath set...".) Instead, they use the classpath defined in their manifest files. You have main-class defined there, you have to define classpath there too. Here's a link to an explanation:
http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html

Similar Messages

  • Oracle 11g application won't start sometimes(jar files issue)

    Hello,
    The issue we experience is that now and then, our forms 11g application
    won't start.
    So it can be the case that, for example, the application can be started
    succesfully 5 times in a row, but the 6th and 7th time, it won't start
    anymore. But when we relaunch it for the 8th time, it launches perfectly.
    When the application isn't starting, a new window is opened having a yellow triangle
    with an exclamation mark on the top right corner.
    After a long period, we suddely discovered that it had something to do with ".jar" files.
    Because when we clear the "java jar cache" on the client machine
    (start -> control panel -> java -> "general" tab -> "view..." button -> select all the files and click on the
    cross(remove selected sources) ), the application succesfully starts for about 10 times in a row.
    But the first time we start the application(after clearing the cache), it takes much longer, because the application
    is downloading the .jar files again. (java logo appears with a progress bar)
    But clearing the cache every time before starting the application can't be a decent solution we think.
    When we enable all java debugging info in the console, we received the error below 2 times when launching a application session that refused to start:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.awt)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
         at sun.plugin2.applet.Applet2SecurityManager.checkPackageAccess(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at oracle.forms.engine.Main.initDesktop(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Anyone having a clue ?
    thanks in advance !

    Sorry, I meant WEB-INF\lib in the WAR file inside my EAR.
    I put all the jar files in the WEB-INF\lib of the WAR file but it still does not work. I have to specify them in the classpaths and put the jar files in the domains\domain\lib directory
    I thought if you put it in the WEB-INF\lib then you don't have to put them in the classpath.
    Am I right?

  • Crystal Report not works in JAR File

    I'm using Eclipse All in one, which includes Crystal Reports.. I Connected my Java program with Crystal Reports and its working properly. Now my problem is that the Report is not working in JAR files.. It throws some exception as
    "com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: com.businessobjects
    com.businessobjects.reports.sdk.JRCCommunicationAdapter---- Error code:-2147215357 Error code name:internal"
    Whats the Error.. I don't know. I think that i may missed some CLASSPATH Files. The included CLASSPATH Files are:
    ReportViewer.jar
    jrcerom.jar
    Concurrent.jar
    CrystalCharting.jar
    CrystalCommon.jar
    CrystalContentModels.jar
    CrystalExporters.jar
    CrystalExportingBase.jar
    CrystalFormulas.jar
    CrystalQueryEngine.jar
    CrystalReportEngine.jar
    CrystalReportingCommon.jar
    icu4j.jar
    keycodeDecoder.jar
    log4j.jar
    MetafileRenderer.jar
    rasapp.jar
    rascore.jar
    rpoifs.jar
    Serialization.jar
    URIUtil.jar
    xercesImpl.jar
    xml-apis.jar
    and the mysql-connector jar file
    Anybody help me please...

    Unable to load database connector
    'com.crystaldecisions.reports.queryengine..driverImpl.
    DriverLoader
    now you have any idea.. pleaseIs that a typo where you have two periods below?
    queryengine..driverImplOther than that I don't think anybody here can help you with that. If your classpath includes all necessary JAR files and you are able to access all your resources from within your application JAR file, then I imagine there is a problem with the third-party crystal decisions JAR file or how you are attempting to use it.
    My advice to you is to try and contact support with the vendor or provider of this API or possibly try posting on a support forum on their website to see if somebody can help you there.

  • Crystal Report not working in JAR File

    I am using Eclipse All in one, which includes the Crystal Report... I Finished every thing and the Crystal Report is working in Eclipse.. But its not working in JAR files.. Anybody suggest me WHICH FILES SHOULD BE SET AS CLASSPATHS FOR CREATING THIS JAR FILE...
    Thanks in advance

    Unable to load database connector
    'com.crystaldecisions.reports.queryengine..driverImpl.
    DriverLoader
    now you have any idea.. pleaseIs that a typo where you have two periods below?
    queryengine..driverImplOther than that I don't think anybody here can help you with that. If your classpath includes all necessary JAR files and you are able to access all your resources from within your application JAR file, then I imagine there is a problem with the third-party crystal decisions JAR file or how you are attempting to use it.
    My advice to you is to try and contact support with the vendor or provider of this API or possibly try posting on a support forum on their website to see if somebody can help you there.

  • Java applications won't work

    On my iMac, Java applications won't work.  I tried opening minecraft, and several other Java applications.  All of them have a message that pops up saying, "Not compatible version of Java 1.5+ is available."  I tried updating it but their is no update for Java it says on my updater.  Running 10.6.8

    Dakota97 wrote:
    I tried openning it but it said it couldn't open because it requires java to run it.
    I don't understand that becuase 10.6.8 should already have Java installed.  It optional in 10.7.x.  It will be interesting to see if the java update even works under these conditions.

  • "completion insight" and "change case as you type" won't work for sql file

    Hi there,
    Just updated to 3.1 on my Mac Lion. It's very likely a bug since it used the work with 3.0.
    I have a "temp.sql" file where I store several queries. I start SQL Developer, open "temp.sql", connect to a DB but "completion insight" and "change case as you type" won't work anymore.
    If I click in "Unshared SQL Worksheet", the new worksheet tab will work fine with completion and change case, but I want to use my temp.sql and save things there when closing the application.
    To reproduce yourself the issue:
    Open SQL Dev, connect to a DB (it will open a worksheet), do some queries and check that change case and completion are working, quit SQL Dev, but save the worksheet in a sql file before. Re-open SQL Dev and open the sql file. Connect to the same DB and try to change the queries or create another. Completion and change case won't work anymore.
    About
    Oracle SQL Developer 3.1.07
    Version 3.1.07
    Build MAIN-07.42
    Copyright © 2005, 2011 Oracle. All Rights Reserved.
    IDE Version: 11.1.1.4.37.59.48
    Product ID: oracle.sqldeveloper
    Product Version: 11.2.0.07.42
    Version
    Component     Version
    =========     =======
    Java(TM) Platform     1.6.0_31
    Oracle IDE     3.1.07.42
    Versioning Support     3.1.07.42

    Well, it's partially working, if your sql file is big (like mine), say with more than 1000 lines, then, maybe because of memory usage, the automatic completion won't work as expected, though, sometimes, after a while, crtl-space would stil work.
    So, the problem may have been addressed, but I believe this feature can be definitely improved.

  • Java files work but jar files do not

    Hello everyone!
    My java files run normally and I get a response that I expect (which is successful). Imagine my surprise when I collected them in a Jar and the very same files inside the jar no longer work! I get a response (still generated by my java program) from successful, it turns to Query Expire.
    My problem is, when executed as normal java programs, the expected result is produced. However, when the jars are executed, the result is expired. What is wrong? The classes and the ones in the jar are the same. Is there something different with the mechanism of Jars that make it erroneous?
    Many thanks in advance. I have been working with this for a week with no progress! =(

    Hi!
    Thanks for your reply. Here's what's happening so far:
    I created my java files using Eclipse and using the Export option, I exported them as a JAR.
    When I run my application on Eclipse with the Java files in tow, the output I expect is Done sending: wait for responses now
    Received response from billing api- A: null(0), C: 13, E: Account already registered
    Register: Failed: 1 Failure(s)Now, on to the JAR file.
    I executed the JAR file using the command java -jar <jar name.jar>
    Here's the response:
    Done sending: wait for responses now
    Received response from billing api- A: null(0), C: -1, E: Query expire w/o response
    Register: Failed: 1 Failure(s)My program communicates with a database and this generates the reply that should be received by my program. My ordinary Java file gets the expected output, but the JAR does not.
    Is it possible that the JAR file somehow slows down the transaction? The reply sent by the database isn't received by the JAR -- somehow, the message gets lost.

  • Server won't start and JAR files

    My application uses external classes (quartz, jersey, jackson) and I included all the jar files containing the external classes in the WEB-INF\lib directory of the EAR file already. I deployed it to WLS 10.3.5 on windows but when I tried to start it up, it failed to start up.
    I copied all those jar files and put them in the <domain>\lib directory and add in the classpath section on the ServerStart tab of the server then it started up.
    I thought if you include those jar files in the WEB-INF\lib of the EAR file then you don't need to put them in the <domain>\lib and specify in the classpath section?
    Do you have any ideas?

    Sorry, I meant WEB-INF\lib in the WAR file inside my EAR.
    I put all the jar files in the WEB-INF\lib of the WAR file but it still does not work. I have to specify them in the classpaths and put the jar files in the domains\domain\lib directory
    I thought if you put it in the WEB-INF\lib then you don't have to put them in the classpath.
    Am I right?

  • Deploying an application with existing library as jar file created with ANT

    Hello All,
    I am having some trouble with a web application I am deploying to Tomcat. I have an custom library that works perfectly as a jar file included in the lib directory if I include all the jars that that library depends on into the lib directory also. What I would like to do is bundle the required jar files into my libraries jar file, but it failes to work when I do that.
    Any thoughts? Does Tomcat prevent this?
    I am using ANT to create my jar file, but when I look at the contents of my jar file it includes all the requested directories.
    My build.xml looks like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="myapp" basedir="." default="jar">
    <property name="classes.dir" value="./classes"/>
    <property name="jar.dir" value="."/>
    <property name="java_lib.dir" value="../../../../../Program Files/Java/lib"/>
    <target name="jar">
    <jar destfile="${jar.dir}/${ant.project.name}.jar">
    <fileset dir="classes"/>
    <fileset dir="${java_lib.dir}" includes="jai_codec.jar.jar"/>
    <fileset dir="${java_lib.dir}" includes="xercesImpl.jar"/>
    <fileset dir="${java_lib.dir}" includes="mysql-connector-java-3.1.8-bin.jar"/>
    <fileset dir="${java_lib.dir}" includes="xmlParserAPIs.jar"/>
    <fileset dir="${java_lib.dir}" includes="mlibwrapper_jai.jar"/>
    <fileset dir="${java_lib.dir}" includes="xml-apis.jar"/>
    <fileset dir="${java_lib.dir}" includes="jai_core.jar"/>
    </jar>
    </target>
    <target name="run" depends="jar">
    <java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/>
    </target>
    <target name="clean-build" depends="jar"/>
    <target name="main" depends="run"/>
    </project>
    Like I said...it includes these jar files in my jar file, but will not function properly with my tomcat app. If I exclude these jar files and include them seperately then everything works.
    NOTE: I do not access any of these libraries directly from any servlets, only from my classes.
    Thanks,
    J-Rod

    This probably isn't posted on the correct forum. This JVM forum is for discussing issues related to running java in an Oracle database using the OJVM, Oracle's embedded java VM. Possibly you are trying to use OJVM through JDEV but that isn't clear from your post and I don't believe that the error you are reporting would occur in that case. If it did or if you are in fact trying to run client java via JDEV the problem would be a JDEV rather than OJVM issue and so the JDEV forum,
    JDeveloper and ADF
    is the correct one to use.

  • JDBC driver is not working in JAR file

    Hello
    Java is new for me.
    In my project JDBC is working fine for MSSQL Server 2000. It is developed in Netbeans.
    Now When I am going to rin JAR file of project, Driver for MSSQL is not found.
    Can anyone tell me that What I have to do to work with MSSQL driver in JAR file of project?
    I am using "Microsoft SQL Server 2000 Driver for JDBC" for JDBC.

    In my project JDBC is working fine for MSSQL Server
    2000. It is developed in Netbeans.
    Now When I am going to rin JAR file of project,
    Driver for MSSQL is not found.
    Can anyone tell me that What I have to do to work
    with MSSQL driver in JAR file of project?
    I am using "Microsoft SQL Server 2000 Driver for
    JDBC" for JDBC.Adding the JAR to the Netbeans project means adding it to the classpath for the IDE only, the JAR which you developed still needs the driver jar in the classpath.

  • Relative URLs not working in JAR file once JAR is moved

    I've been loading images with the following:
    public static final ImageIcon anIcon = new ImageIcon("iconName.gif");
    This works fine when all the class files are in the same folder with the gifs. I then packaged the whole folder into a .jar file, moved the resulting .jar file to another directory, tried running it and none of the icons loaded. They are present in the .jar file, why doens't the relative URL still work? Is there simply another way to write the URL so that it knows to look in the .jar file?
    Thanks for help,
    Robert Douglass

    Is there simply another way to write the URL so that it knows to look in the .jar file?Once you put the class files along with your gif files in a jar, you have to access the gif file like this:
    import java.net.*;
    URL url=myClass.class.getResource("iconName.gif");
    ImageIcon anIcon = new ImageIcon(url);
    Where myClass is the name of your class file.
    V.V.

  • Java applet won't load from Jar file

    Hi all,
    I have a problem which I didn't used to have. I have written an applet which used certain classes stored in directories. It used to work just fine. I recently updated the main class from which the applet starts and since then I get error messages:
    Java Plug-in 1.6.0_26
    Using JRE version 1.6.0_26-b03-384-10M3425 Java HotSpot(TM) 64-Bit Server VM
    User home directory = /Users/benoize
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class WiaRekenToolHC.class not found.
    java.lang.ClassNotFoundException: WiaRekenToolHC.class
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:252)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:250)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:180)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:161)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:687)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3046)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1498)
         at java.lang.Thread.run(Thread.java:680)
    Exception: java.lang.ClassNotFoundException: WiaRekenToolHC.class
    As you can see it says that it can't find the class WiaRekenToolHC, but it's there in the jar files.
    Here is the link where you can see it:
    www.creativemathsolutions.nl/demo/HC/demo.html
    The jar files are in the directory HC and Generic.
    If you need more info then let me know!
    Regards, Benoit

    <applet
      codebase="http://www.creativemathsolutions.nl/demo/HC"
      code="WiaRekenToolHC.class"
      ARCHIVE="HC/wia_hc_archive_v0_3.jar, Generic/wia_archive_v0_3.jar"
      width=900 height=600>The code-base combined with archive href for the first Jar mean the JRE will look for it at:
    http://www.creativemathsolutions.nl/demo/HC/HC/wia_hc_archive_v0_3.jar
    It is not there. The other Jar is also missing from the stated location.

  • Applications won't work after archive and reinstall

    My wife has an iBook G3. After automatic update she got the red circle with a slash in it. She rebooted to the install disk and chose to archive and reinstall. After doing this and restarting, several applications will not work. For sure itunes, safari, iphoto and perhaps other she has not tried. The message she gets is: "The application cannot be launched because the system is incompatible." Suggestions? Thank you. Steve
    iBook G4   Mac OS X (10.4.7)  

    To A Brody, thanks for the link to the backup info page..that was very helpful.
    I'm having a panic with two volumes with 10.3.9 and 10.4.3 getting corrupted and impossible to repair or reinstall...and getting errors that "may be bad blocks...bad media.." and am backing up all the photos and music to a usb ext HD.
    I'm only able to start up with os9 and am careful...perhaps not enough, I don't know, to not do anything to the osx files I can see from the other parition with os 9.
    So far I've just dragged the files I want to the ext HD. I think I will do it again with a disc image as well, on the same ext HD, and burn dvd's later.So far, testing the backup with another mac in osx, I'm able to see the pictures with Preview, and import the music and play it...but yikes, no backup is like running with scissors. Two different friends are also backup less and they both use their macs for business! I hope to get them fixed up as well.
    I'm going to post a new question about the phrase: "Mac OS X can't be installed on an ATA/IDE drive that is configured as a "slave", although it can see and work with such drives.": from one of the best books on OS X. Is this true?
    G3 233hz desktop   Mac OS X (10.4.3)   567mb ram, xpostfacto

  • Working with jar files

    Hi Friends
    I created a project and tried to Make a Executable jar file. actually. got it. it is also Running when i click on the Executable jar file.
    Now my problem is I am using some Images for my application those images are in a directory Called Image . when i make JAR File.
    i use This Command
      jar cfvm Setup.jar Manifest.txt *.class Imageit creates a JAR Files called setup.
    it runs the Application also when i run the Project. Now when i copy the Setup.jar to some other Location Other than the Current Location.
    It is not showing the Images which are allready in my Application
    I don't the problem. I read through the java tutorials But i am not able to find out the Solution for this Problem
    Please help me out to overcome this Problem
    Thank you for your service
    Cheers
    Jofin

    Hi thank you for your reply
    Realy i don't follow what you say, Where you are telling me to add this line Main.class.getResource("Image/file.gif"). Whether in The Manifest File or Where ever, i read the Images?
    Actually i have 5 JFrame Where all the Frames Uses Images. Should i need to use this Line in all the 5 classes . Could you please explain me clearly.
    i am very new to java. so that i am not able to pick up quickly. please bare with me
    Thank you for your service
    Cheers
    Jofin

  • MY applications won't work

    Every time i try to go on a game or any aplication on my
    phone it always says Supportive file nothing to display
    I didint do any strange on it
    just one day it started happening
    I need help
    PLZ some one help

    Maybe the files on your memory card got corrupted? Or maybe you could just restart your phone and try if the applications are now working.
    Good luck

Maybe you are looking for