NoClassDefFound Error

I have developed an application using netbean IDE in Linux  and it works fine , when I distribute the application as jar file and when i execute the same then i get NoClassDefFound error .I am  posting the error message as well for help.
Thanks in advance

[root@node2 dist]# java -jar "HCL.jar"
Warning: -jar not understood. Ignoring.
Exception in thread "main" java.lang.NoClassDefFoundError: HCL.jar
   at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
   at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
   at __gcj_personality_v0 (/root/HCL/dist/java.version=1.4.2)
   at __libc_start_main (/lib/tls/libc-2.3.4.so)
   at _Jv_RegisterClasses (/root/HCL/dist/java.version=1.4.2)





LVL 9
pradapkumarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WebstormCommented:
try:
  java -cp HCL.jar <yourmainclass>
WebstormCommented:
java -jar HCL.jar
   would work if you downloaded a more recent version of Java.
NelliosCommented:
When you create a jar file there is a file called MANIFEST.MF inside it and you can see it if you extract the jar content with any zip managment software.

In that file the classpath is added. Your problem is that inside this file you have insufficient classpath information.

1) Extract that file & check it
2) Search your IDE help on how to determine the classpath on the jarfiles it generates.

if the classpath is ok, then it is something wrong with the classes.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
http://www.cs.usfca.edu/~parrt/course/601/lectures/java.tools.html

check out this link.

and as such you just need to specify the  class path & execute this command.

java -classpath HCL.jar SomeMain

Where in the above example SomeMain.java is the class which has a Main method in it.

if there are multiple files in ur jar which have main main function in it the you need to explicitly specify the class which
you want to execute and if there is any package inside a jar then you need to specify the package name too like.

java -classpath HCL.jar shiva.SomeMain

where in above shiva is the package name & SomeMain is the class inside it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WebstormCommented:
>> and as such you just need to specify the  class path & execute this command.
already said in my first comment
NelliosCommented:
Webstorm. It is not required to specify the classpath in the command line.
As soon as all the required classes are included in the jar, the proper way to do it is the CLASSPATH directive inside MANIFEST.MF file
WebstormCommented:
Nellios, see asker's question :
>> Warning: -jar not understood. Ignoring.

-> java don't recognize -jar option
-> classpath needed
sciuriwareCommented:
Nellios, that's the second time; I warn you.
Mayank SAssociate Director - Product EngineeringCommented:
BTW, where is HCL.jar located? Has it even been distributed or not?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.