Problem Running Application (Java + JExcel API)

T

TheNewf

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
 
A

Andrew Thompson

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

TheNewf

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)
 
J

Joan

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

TheNewf

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

Joan

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"
 
T

TheNewf

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

Robert kebernet Cooper

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

TheNewf

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

Raymond DeCampo

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
 
T

TheNewf

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

TheNewf

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

TheNewf

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top