473,372 Members | 1,059 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,372 software developers and data experts.

No Class Definition Found Error

2
I am completly new to Java and to programing in general. I have downloaded and installed JDK version 6, update 7 on my system runninig Windows XP SP3.
I have the path set and the compiler running but when I try the java command I get this error message;

Exception in thread "main" java.lang.NoClassDefFoundError: hello (wrong name: Hello)

I copied the sorce code exactly from the instructions I am following and have been searching the web for an answer.
Where did I go wrong?
Jul 11 '08 #1
7 10340
Dököll
2,364 Expert 2GB
Hey there partner!

Sorry for your troubles, I am sure it's annoying...

What type of compiler are you using? I am also knew to this, if you're using Eclipse for instance, you can right-click on he red x where yourerror shows and you'll have a variety of options you can use.

Hope you get this one nailed if it is so...

In a bit!
Jul 12 '08 #2
Laharl
849 Expert 512MB
Sounds like he's using the regular Sun command line tool. This is a classpath error. What you need to do is add '.', the current directory, to your Java classpath. How you do this I'm a little fuzzy, I'm afraid, as I use Linux, not Windows, for most of my dev work and use IDEs when in Windows for exactly this reason.
Jul 12 '08 #3
JosAH
11,448 Expert 8TB
Exception in thread "main" java.lang.NoClassDefFoundError: hello (wrong name: Hello)

Where did I go wrong?
The name of your class and/or file is wrong (see the error message). Java is
case sensitive and you have mixed up an upper or lowercase letter.

kind regards,

Jos
Jul 12 '08 #4
Hi,
Your problem is that of CLASSPATH Settings. It is an 'Environment Variable' (If you find the term strange, then just a VARIABLE. If you are working on Windows XP, then follow the simple steps below:
1. Right Click My Computer Icon in Desktop.
2.Switch to the ADVANCED TAB.
3.Add a Classpath variable to the system by clicking on new under USER VARIABLES.
4. A box will pop-up.
5. Enter CLASSPATH for VARIABLE NAME.
6. Enter '.;' (DOT-Semicolon) for VARIABLE VALUE.

The CLASSPATH simply specifies where your java.exe has to reside for successful execution of your program. You may ADD ANOTHER path by CONCATENATING it with the VARIBLE VALUE, separated by a semi-colon.

Think that should help you out of that.

AN ADVICE:

Running Java Programs can be a headache if you ignore Cases in Class-names etc. After this preoblem is solved, look out if you made any mistakes of that kind.
Jul 12 '08 #5
JosAH
11,448 Expert 8TB
The CLASSPATH simply specifies where your java.exe has to reside for successful execution of your program.
That is just nonsense. And the OP's problem isn't a classpath issue either: the
JVM did find a file but the name didn't correspond with the class stored in that
file. Probably an uppercase/lowercase problem. Setting the environment variable
CLASSPATH is a clumsy way to set your classpath; read this for a nice
explanation of what the classpath actually is. It is not for locating your java.exe;
you'll need the PATH variable for that.

kind regards,

Jos
Jul 12 '08 #6
3rds
2
It was an uppercase/lowercase problem. Thanks for the help and advice. Now I can start moving forward again and maybe be a little more pleasent to be around.
Thank You All
Jul 13 '08 #7
JosAH
11,448 Expert 8TB
It was an uppercase/lowercase problem. Thanks for the help and advice. Now I can start moving forward again and maybe be a little more pleasent to be around.
Thank You All
Good to hear; lesson learned: always carefully read the error diagnostic message;
all the information is in there (see your original post and error description). btw,
you weren't unpleasant at all. Incorrect advice is more of a nuisance than questions
like yours.

kind regards,

Jos
Jul 13 '08 #8

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

Similar topics

3
by: Tony Johansson | last post by:
Hello! I have these two statements typedef const char *enum_txt; and enum_txt phase_tab ={"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERRELEASE","SPACE"}; where in the class definition...
3
by: Tony Johansson | last post by:
Hello!! I have these two statements "typedef const char *enum_txt;" "enum_txt phase_tab = {"IDLE","LAUNCHING","LAUNCHED","ROLLING","BOOSTERRELEASE","SPACE"};" It's no problem to put the...
14
by: Mike Hewson | last post by:
Have been researching as to why: <example 1> class ABC { static const float some_float = 3.3f; }; <end example 1>
5
by: BlackBeltNerd | last post by:
I am using XP Pro with IIS5.1. my classic ASP programs were working fine but now ASPX programs work but ASP programs result in an error message "class not found". Anyone run into this issue, if so...
2
by: Marcosu | last post by:
Hi, I have a problem in a template with a class definition. In a template class (Foo) ther is a class (Bar) and a list of pointer to this class (m_l). In Foo's destructor I would like to clear...
5
by: Amit_Basnak | last post by:
Dear Friends I have been getting the following error Error 185: "WorkFlow_dce.cpp", line 58 # Left side of '->' requires a pointer to class; type found was 'struct WF_SEARCH_WU'....
10
by: SpreadTooThin | last post by:
I am having trouble getting a piece of code to compile on VC++ 6.0... Compiles fine on MAC OS X under X-Code.... #include <list> class myClass { private: std::string name;...
3
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi, I have found a need to define a class for use in a page code-behind class file. I have a well structured model which consists of business logic components and data access components. The...
1
by: vijayann | last post by:
when i compile java program there is no compilation error in that program but at runtime i got class not found error what is the meaning that error
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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.