473,883 Members | 1,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception in thread "main" java.lang.NoCla ssDefFoundError

3 New Member
I don't why I get this error:
Exception in thread "main" java.lang.NoCla ssDefFoundError

The statement below works just fine:
java -cp "appframewo rk-1.0.3.jar;swing-worker-1.1.jar";Curren tStrobe.jar com.visionpro.c urrentstrobe.Cu rrentStrobeApp

However, the statement below produces the error:
java -cp "appframewo rk-1.0.3.jar;swing-worker-1.1.jar" -jar CurrentStrobe.j ar

Exception in thread "main" java.lang.NoCla ssDefFoundError : org/jdesktop/application/SingleFrameAppl ication
at java.lang.Class Loader.defineCl ass1(Native Method)
at java.lang.Class Loader.defineCl ass(Unknown Source)
at java.security.S ecureClassLoade r.defineClass(U nknown Source)
at java.net.URLCla ssLoader.define Class(Unknown Source)
at java.net.URLCla ssLoader.access $000(Unknown Source)
at java.net.URLCla ssLoader$1.run( Unknown Source)
at java.security.A ccessController .doPrivileged(N ative Method)
at java.net.URLCla ssLoader.findCl ass(Unknown Source)
at java.lang.Class Loader.loadClas s(Unknown Source)
at sun.misc.Launch er$AppClassLoad er.loadClass(Un known Source)
at java.lang.Class Loader.loadClas s(Unknown Source)
at java.lang.Class Loader.loadClas sInternal(Unkno wn Source)
Caused by: java.lang.Class NotFoundExcepti on:org.jdesktop .application.Si ngleFrameApplic ation
at java.net.URLCla ssLoader$1.run( Unknown Source)
at java.security.A ccessController .doPrivileged(N ative Method)
at java.net.URLCla ssLoader.findCl ass(Unknown Source)
at java.lang.Class Loader.loadClas s(Unknown Source)
at sun.misc.Launch er$AppClassLoad er.loadClass(Un known Source)
at java.lang.Class Loader.loadClas s(Unknown Source)
at java.lang.Class Loader.loadClas sInternal(Unkno wn Source)
... 12 more
Could not find the main class: com.visionpro.c urrentstrobe.Cu rrentStrobeApp. Program will exit.

Any ideas?
Sep 26 '08 #1
4 14753
sukatoa
539 Contributor
I've also encountered that one before,

What i did is i've set the classpath inside the Manifest file instead of doing like what you did in the commandline.

try it
Sep 27 '08 #2
jmitch89
3 New Member
I was thinking of doing that.

I just wonder why this happens. I've used this syntax before without any problems. I'm sure it's a classpath issue but I don't know why it happens.

They say ignorance is bliss but I hate not understanding why.
Sep 29 '08 #3
JosAH
11,448 Recognized Expert MVP
I don't why I get this error:
Exception in thread "main" java.lang.NoCla ssDefFoundError

The statement below works just fine:
java -cp "appframewo rk-1.0.3.jar;swing-worker-1.1.jar";Curren tStrobe.jar com.visionpro.c urrentstrobe.Cu rrentStrobeApp

However, the statement below produces the error:
java -cp "appframewo rk-1.0.3.jar;swing-worker-1.1.jar" -jar CurrentStrobe.j ar

Exception in thread "main" java.lang.NoCla ssDefFoundError : org/jdesktop/application/SingleFrameAppl ication

Any ideas?
In the first version you supply the class where the main() method is to be found:
in class com.visionpro.c urrentstrobe.Cu rrentStrobeApp

In the second version your jar tells the JVM to look for the class
org/jdesktop/application/SingleFrameAppl ication which can not be found by the
JVM. Fix the manifest in in the CurrentStrobe.j ar.

kind regards,

Jos
Sep 29 '08 #4
jmitch89
3 New Member
The manifest inside the CurrentStrobe jar files read as follows:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b19 (Sun Microsystems Inc.)
Main-Class: com.visionpro.c urrentstrobe.Cu rrentStrobeApp

I added,

Class-Path: appframework-1.0.3.jar swing-worker-1.1.jar

and now it works just by issuing the following command:

java -jar CurrentStrobe.j ar

Thanks for the help...
Sep 29 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3015
by: Phillip Montgomery | last post by:
Hello all; I'm trying to debug an issue with a java script called, SelectSockets. It appears to be a fairly common one found on the web. I downloaded the SGI Java v1.4.1 installation from SGI's webpage and installed it using SGI's swmgr application. The installation was very straight forward and there were no errors when I installed the package. Then I ran /usr/java2/bin/javac SelectSockets.java to make the SelectSockets.class file.
1
9131
by: Andy Howells | last post by:
Can anybody help me on this? I am getting the below error but have not got a clue why. The file in my classpath eing used has the class that it says is not defined. Any ideas? I am running java version 1.4.0 and WMQ Series version 5.3 with CSD04. Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/mq/server/MQSESSION at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:67) at...
7
2770
by: news | last post by:
I am pretty new to Java and I just install the JDK1.4.2 03 I am getting an error when I run the class file TestChart.class with the java.exe: Exception in thread "main" java.lang.NoClassDefFoundError: I have several class files in the directory d:\personal\java-ChartGen Chart.class ChartColourScheme.class
2
45756
by: dave | last post by:
(Forgive all caps... they are there to differentiate btw question and code) THIS IS THE ERROR I KEEP GETTING. IT COMPILES BUT WHEN IT RUNS, THE FOLLOWING POPS UP: Exception in thread "main" java.lang.NoClassDefFoundError: PlayClip THIS IS MY CODE: import java.applet.*; import java.io.*; import java.net.*;
9
3134
by: jith87 | last post by:
What is ths error.????? I m nw loading the JDBC driver for connection with MySql. Exception in thread "main" java.lang.NoClassDefFoundError: MySQLJDBCDriverTest
3
6454
by: Ananthu | last post by:
Hi This is my codings in order to access mysql database from java. Codings: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;
9
3292
by: tiyaramunna | last post by:
I am trying to configure my system with Java program just to practice on the coding....when i compile a test.java program i am able to see the class file but i cant run the program ... I am getting the following error Exception in thread "main" java.lang.NoClassDefFoundError: test Caused by: java.lang.ClassNotFoundException: test at java.net.URLClassLoader$1.run(Unknown Source) at...
3
7665
by: ohadr | last post by:
hi, i get Exception in thread "main" java.lang.NullPointerException when i run my application. the exact error is: "Exception in thread "main" java.lang.NullPointerException at sortmergejoin.MergeJoin.Field(MergeJoin.java:204) at sortmergejoin.MergeJoin.SMJoin(MergeJoin.java:84) at sortmergejoin.MergeJoin.<init>(MergeJoin.java:34) at sortmergejoin.Main.main(Main.java:24) Java Result: 1"
1
6766
by: onlinegear | last post by:
HI i am writing this for college i know i have loads of combo boxes with nothing in the i havent got that far yet. but every time i run this is comes up with this erro run: Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Container.java:1041) at java.awt.Container.add(Container.java:365) at orderingsystem.OrderingSystem.<init>(OrderingSystem.java:261) at...
0
9938
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11140
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10414
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7971
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7125
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3232
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.