473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

NoClassDefFoundError

Please i am trying to run a java application but i keep getting this error:
NoClassDefFoundError
However, if i run the file from the bin folder it works but i dont want to keep changing directory to the bin folder to run my applications. I want to run the file as long as i have the same folder where this file is saved as the active directory at comand line
May 8 '08 #1
3 1039
Laharl
849 Expert 512MB
This is a classpath error of some sort. If it can't find the class with main() in it, you need to add the folder with the class in it to the classpath. If it's something you've imported, add the folder where that source is to the classpath. I've never been entirely certain how one does this (I use Linux), but I believe if you compile (and possibly run) with the -classpath . flag (eg java -classpath . filename), it'll help this.
May 8 '08 #2
Kid Programmer
176 100+
This means you have not defined a class. Make sure you typed something like:
Expand|Select|Wrap|Line Numbers
  1.  
  2. class BLAH {
  3.  
If it is a public class don't forget to save the file with the same name as the class.
May 8 '08 #3
JosAH
11,448 Expert 8TB
This means you have not defined a class. Make sure you typed something like:
Expand|Select|Wrap|Line Numbers
  1.  
  2. class BLAH {
  3.  
If it is a public class don't forget to save the file with the same name as the class.
That could be it but is unlikely; more likely is that the JVM can't find the class
because it is not stored somewhere to where the classpath points. The classpath
variable is a list of directories where the JVM searches for classes. For beginners
it can be as simple as a '-classpath .' flag value which makes the JVM search for
classes in the current directory.

kind regards,

Jos
May 9 '08 #4

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

Similar topics

11
by: Lem | last post by:
I get the error Exception in thread "main" java.lang.NoClassDefFoundError when I type java app2 in the command prompt. I've tried moving to the jre directory and typed java c:\app2\app2, but it...
1
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...
0
by: Shawn | last post by:
I am getting the following error with a Java Applet being served out by IIS over HTTPS/SSL using a Verisign certificate: java.lang.NoClassDefFoundError: javax/help/HelpSetException at...
3
by: NathanK | last post by:
Hi Guys, im starting out in java and i'm getting the error: Exception in thread "main" java.lang.NoClassDefFoundError: blurf if i run "javac blurf.java", it compiles fine and without any...
1
by: Staz | last post by:
Hi all I am getting a NoClassDefFoundError from sun.misc.Unsafe.ensureClassInitialized, but the exception has no message so I have no way of knowing what class it cannot find. The application...
2
by: Janwillem Borleffs | last post by:
Hello, I have implemented some of the libraries from the Axis 1.1 package and getting a NoClassDefFoundError exception when running it under Tomcat 4.1.24 (the compilation was performed with...
1
by: greg.knaddison | last post by:
Hi, I'm trying to use the httpclient within Jython (see http://jakarta.apache.org/commons/httpclient/ for more information on the httpclient). My Jython version is: Jython 2.1 on...
3
by: NamelessNumberheadMan | last post by:
I'm using MyEclipse to make a quick one or two use jar utility file to connect to a database and run some updates. I can get everything to compile fine, and create the jar without an issue, but when...
1
Nepomuk
by: Nepomuk | last post by:
Hi! I'm working on a project using tomcat and spring. Now I have written a Bean class, which reads an XML-File via Springs XmlBeanFactory, creates a Vector from the collected Information and then...
4
by: jmitch89 | last post by:
I don't why I get this error: Exception in thread "main" java.lang.NoClassDefFoundError The statement below works just fine: java -cp...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.