473,749 Members | 2,636 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 14727
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
3005
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
9118
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
2766
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
45746
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
3126
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
6443
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
3285
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
7658
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
6756
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
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9568
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...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
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
8257
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...
0
6079
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
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.