Problem Running Application (Java + JExcel API)

Discussion in 'Java' started by TheNewf@gmail.com, Jun 28, 2005.

  1. Guest

    I am having a problem writing a program and i am getting an error that
    stumps me.

    $ java -jar WorkApp3.jar

    and i get error:

    Exception in thread "main" java.lang.NoClassDefFoundError:
    jxl/read/biff/BiffException
    at workapp3.Main.<init>(Main.java:35)
    at workapp3.Main.main(Main.java:64)

    i also tried:

    $ javaw WorkApp3.jar

    i get a popup saying "Could not find the main class. Program will
    exit."

    when i run the program in NetBeans IDE 4.1 the program seems to run the
    way i want it to. I can't understand what's going on??

    any help would be grateful!

    The Newf
    , Jun 28, 2005
    #1
    1. Advertising

  2. Andrew Thompson, Jun 28, 2005
    #2
    1. Advertising

  3. Guest

    yes my manifest file is as follows:

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.2
    Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
    Main-Class: workapp3.Main
    X-COMMENT: Main-Class will be added automatically by build

    I have only 2 files at the moment and they are both in the workapp3
    directory. the files are:
    1) Main.java - which is my has my main() and will eventually have the
    GUI i plan to make.
    2) ExcelData.java - which at the moment takes the data from an excel
    document and exports it to a text file(easier to work with)
    , Jun 28, 2005
    #3
  4. Joan Guest

    <> wrote in message
    news:...
    > I am having a problem writing a program and i am getting an error that
    > stumps me.
    >
    > $ java -jar WorkApp3.jar
    >
    > and i get error:
    >
    > Exception in thread "main" java.lang.NoClassDefFoundError:
    > jxl/read/biff/BiffException
    > at workapp3.Main.<init>(Main.java:35)
    > at workapp3.Main.main(Main.java:64)
    >


    I had this problem before, it is not main that is missing,
    it is BiffException that is missing. BiffException is in jxl.jar
    Try putting jxl.jar in your classpath.
    Joan, Jun 28, 2005
    #4
  5. Guest

    the classpath ... that would be on the comand prompt:

    $ java -jar -classpath .\jxl.jar WorkApp3.jar

    right? if the jxl.jar and my WorkApp3.jar are both in the same
    directory?

    i still get the same error? or am i doing the classpath wrong?
    , Jun 28, 2005
    #5
  6. Joan Guest

    <> wrote in message
    news:...
    > the classpath ... that would be on the comand prompt:
    >
    > $ java -jar -classpath .\jxl.jar WorkApp3.jar
    >
    > right? if the jxl.jar and my WorkApp3.jar are both in the same
    > directory?
    >
    > i still get the same error? or am i doing the classpath wrong?


    I can't remember the exact details but I was having classpath
    trouble when using the "-jar" flag.
    I tried a whole bunch of things and just kept banging away till it worked.
    Try putting the jxl.jar in your
    directory outside the jar file,
    in fact try taking all the classes out of the jar file,
    and using "java" instead of "java -jar"
    Joan, Jun 28, 2005
    #6
  7. Guest

    umm... I tried as you suggested....i complied my files with little
    trouble. but when i try to run them:

    $ java -classpath .\jxl.jar Main
    Exception in thread "main" java.lang.NoClassDefFoundError: Main

    but when i tried:

    $ java -classpath .\ Main
    Exception in thread "main" java.lang.NoClassDefFoundError:
    jxl/read/biff/BiffException
    at Main.<init>(Main.java:35)
    at Main.main(Main.java:64)

    so in my directory i have:
    ExcelData.class
    ExcelData.java
    jxl.jar
    Main.class
    Main.java

    I just thought of trying this while writing this response:

    $ java -classpath .\;.\jxl.jar Main

    and it worked. Thank you Joan for the idea!!

    now how am i able to get it so that it's all neat and tidy in a jar
    file, so i don't have a bunch of files lying around? and is their a way
    to set the classpath in the manifest file?
    , Jun 28, 2005
    #7
  8. If you put the jxl.jar in the same directory as your jar and specify
    "Class-Path: ./jxl.jar" in your Manifest file, you should get the
    effect you are looking for.
    Robert kebernet Cooper, Jun 28, 2005
    #8
  9. Guest

    Thanks it's working almost perfectly.. thanks.

    I hope this is my final question but I need a lot of memory to run this
    program. I know the command:

    $ java -Xms10m -Xmx100m -jar WorkApp3.jar

    But I was wondering if it were possible to add this to the manifest
    file or in the program itself so that I can just double click on the
    WorkApp3.jar file and it will run with the extra memory that it
    requires, rather then runing from dos?
    , Jun 28, 2005
    #9
  10. wrote:
    > the classpath ... that would be on the comand prompt:
    >
    > $ java -jar -classpath .\jxl.jar WorkApp3.jar
    >
    > right? if the jxl.jar and my WorkApp3.jar are both in the same
    > directory?
    >
    > i still get the same error? or am i doing the classpath wrong?


    The -jar options and the -classpath options are incompatible. RTFM, it
    came with the JDK.

    Ray

    --
    XML is the programmer's duct tape.
    Raymond DeCampo, Jun 28, 2005
    #10
  11. Guest

    I read the manual and i was wondering if their was a way to do the
    memory Allocation i need thats the not the jar.
    , Jun 29, 2005
    #11
  12. Guest

    I read the manual and i was wondering if their was a way to do the
    memory Allocation i need thats the (-Xms10m -Xmx100m) not the jar.
    , Jun 29, 2005
    #12
  13. Guest

    I Read the manual... i was wondering about the memory Allocation i
    need.... that the -Xms10m -Xmx100m if you didn't read the question. not
    the jar
    , Jun 29, 2005
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dhaval dalal via JavaKB.com

    Running an Executable from a JAVA API in LINUX

    dhaval dalal via JavaKB.com, Mar 1, 2005, in forum: Java
    Replies:
    16
    Views:
    1,001
    Gordon Beaton
    Mar 2, 2005
  2. Deep
    Replies:
    1
    Views:
    2,765
    TechBookReport
    Mar 2, 2006
  3. GenxLogic
    Replies:
    1
    Views:
    828
    TechBookReport
    Mar 3, 2006
  4. Gayan
    Replies:
    0
    Views:
    838
    Gayan
    Jun 29, 2006
  5. ruds
    Replies:
    1
    Views:
    2,450
    Martin Gregorie
    Jun 7, 2008
Loading...

Share This Page