473,406 Members | 2,710 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,406 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 10347
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
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.