Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem Running Application (Java + JExcel API)

Reply
Thread Tools

Problem Running Application (Java + JExcel API)

 
 
TheNewf@gmail.com
Guest
Posts: n/a
 
      06-27-2005
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

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-27-2005
On 27 Jun 2005 16:10:05 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> I am having a problem writing a program and i am getting an error that
> stumps me.
>
> $ java -jar WorkApp3.jar

....

Does this jar have a manifest file that specifies
the 'main()' class?

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
 
TheNewf@gmail.com
Guest
Posts: n/a
 
      06-28-2005
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)

 
Reply With Quote
 
Joan
Guest
Posts: n/a
 
      06-28-2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.


 
Reply With Quote
 
TheNewf@gmail.com
Guest
Posts: n/a
 
      06-28-2005
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?

 
Reply With Quote
 
Joan
Guest
Posts: n/a
 
      06-28-2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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"


 
Reply With Quote
 
TheNewf@gmail.com
Guest
Posts: n/a
 
      06-28-2005
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?

 
Reply With Quote
 
Robert kebernet Cooper
Guest
Posts: n/a
 
      06-28-2005
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.

 
Reply With Quote
 
TheNewf@gmail.com
Guest
Posts: n/a
 
      06-28-2005
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?

 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      06-28-2005
(E-Mail Removed) 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using jexcel api to write excel to csv file ruds Java 1 06-07-2008 08:08 AM
Need help for COM running from Web application, but not form .EXE application JeffQ888@gmail.com ASP .Net 1 05-23-2006 03:20 PM
[JExcel API] how to insert object into a cell GenxLogic Java 1 03-03-2006 11:07 AM
[JExcel API] how to insert object into cells Deep Java 1 03-02-2006 02:19 PM
How to get the name of a running asp.net application from the application itself??? Bob Rock ASP .Net 2 06-14-2004 06:44 PM



Advertisments