Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Problem Running Application (Java + JExcel API)

Thread view: 
TheNewf@gmail.com - 28 Jun 2005 00:10 GMT
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
Andrew Thompson - 28 Jun 2005 00:29 GMT
> 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?

Signature

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

TheNewf@gmail.com - 28 Jun 2005 01:24 GMT
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)
Joan - 28 Jun 2005 02:36 GMT
> I am having a problem writing a program and i am getting an error that
> stumps me.
[quoted text clipped - 7 lines]
>         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.
TheNewf@gmail.com - 28 Jun 2005 02:44 GMT
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?
Joan - 28 Jun 2005 02:48 GMT
> the classpath ... that would be on the comand prompt:
>
[quoted text clipped - 4 lines]
>
> 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"
TheNewf@gmail.com - 28 Jun 2005 03:13 GMT
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?
Robert kebernet Cooper - 28 Jun 2005 03:36 GMT
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.
TheNewf@gmail.com - 28 Jun 2005 04:40 GMT
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?
Raymond DeCampo - 28 Jun 2005 15:02 GMT
> the classpath ... that would be on the comand prompt:
>
[quoted text clipped - 4 lines]
>
> 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

Signature

XML is the programmer's duct tape.

TheNewf@gmail.com - 29 Jun 2005 05:52 GMT
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.
TheNewf@gmail.com - 29 Jun 2005 05:52 GMT
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.
TheNewf@gmail.com - 29 Jun 2005 05:54 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.