Results 1 to 6 of 6
  1. #1
    Nympho is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default Launching a jar file

    Hello, i have problms with launching a jar file.When i try to launch it using java -jar mmeditor.jar it gives me erorr

    c:\SWD\MMEditor>java -jar MMEditor.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
    gging/LogFactory
    at cz.cvut.fjfi.hofman.mmm.model.database.DatabaseMod el.<clinit>(Databas
    eModel.java:20)
    at cz.cvut.fjfi.hofman.mmm.MappingCreator.<init>(Mapp ingCreator.java:38)
    ....
    missing library can be found here:
    Commons Logging - Overview
    jar file can be found here:
    METAmorphoses: DB to RDF transformation - Browse /MM Mapping Editor/1.0 at SourceForge.net

    How can i include missing library to the classpath and launch a jar file?

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    Hi, you can use embedded help in Java.
    java -help
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A : separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    Nympho is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default

    I have read somewhere that classpath is ignored in java while runing jar files.

  4. #4
    Nympho is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default

    i have mmeditor.jar file in
    C:\SWD\MMEditor
    and needed library's at c:\swd\MMEditor\lib\

    so i try to do so:

    c:\SWD\MMEditor>java -cp c:\swd\MMEditor\lib\ -jar MMEditor.jar
    c:\SWD\MMEditor>java -cp c:\swd\MMEditor\lib\commons-logging-1.1.1.jar -jar MEditor.jar

    and still i get error

    c:\SWD\MMEditor>java -cp c:\swd\MMEditor\lib\ -jar MMEditor.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
    gging/LogFactory
    at cz.cvut.fjfi.hofman.mmm.model.database.DatabaseMod el.<clinit>
    .......

    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)

    .....

  5. #5
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    Well, I unpack the MMEditor.jar. It has manifest file.
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
    Main-Class: cz.cvut.fjfi.hofman.mmm.MappingCreator
    Class-Path: antlr-2.7.5.jar postgresql-8.1-407.jdbc3.jar jconn3.jar my
    sql-connector-java-3.1.11-bin.jar antlr-2.7.5.jar jena.jar json.jar s
    tax-api-1.0.jar xercesImpl.jar wstx-asl-2.8.jar icu4j_3_4.jar concurr
    ent.jar xml-apis.jar arq.jar iri.jar postgresql-8.1-407.jdbc3.jar jco
    nn3.jar jena.jar jenatest.jar stax-api-1.0.jar dom4j-1.6.1.jar xerces
    Impl.jar stax-1.1.1-dev.jar mysql-connector-java-3.1.11-bin.jar commo
    ns-logging.jar icu4j_3_4.jar concurrent.jar log4j-1.2.12.jar xml-apis
    .jar arq.jar jakarta-oro-2.0.8.jar junit.jar
    For launcher Jar you need all library, which pointed here.
    for example
    lib/commons-logging.jar
    lib/MMEditor.jar
    lib/..
    java -jar MMeditor.jar
    It is all.
    Skype: petrarsentev
    http://TrackStudio.com

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    Except they won't be in lib.
    That class-path in the manifest doesn't use lib/<jar file name>. It's just the jar file, so they all need to be on the same level as the MMEditor.jar.

Similar Threads

  1. Launching an exe
    By kanupriya in forum New To Java
    Replies: 19
    Last Post: 01-19-2011, 11:24 AM
  2. launching applet via jsp
    By rafzio4 in forum New To Java
    Replies: 2
    Last Post: 09-24-2010, 09:35 AM
  3. launching .rm file outside java
    By nonboyx in forum Threads and Synchronization
    Replies: 2
    Last Post: 09-28-2009, 08:40 PM
  4. Launching applications without an IDE
    By this_is_phil in forum New To Java
    Replies: 6
    Last Post: 05-24-2008, 08:54 AM
  5. Launching Applet from a JSP page
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-31-2008, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •