English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i am getting this error
" Exception in thread "main" java.lang.NoClassFoundError: "

2007-09-25 03:03:26 · 5 answers · asked by ayesha 1 in Computers & Internet Programming & Design

5 answers

if u'r using jcreator on vista then the command prompt won't work, I use eclipse to work on java, and from the looks of it u have an error in the main class I think u didn't do a main class for it to work or there's a class missing in it

2007-09-25 03:18:45 · answer #1 · answered by Anonymous · 0 1

To get this error you have certainly a properly installed java runtime environment, so discard solution that hint you on how to install the JRE.

The problem should be about classpath.

If you have a java source that is called Hello.java which belongs to the package com.example after complile you should have a file called Hello.class in a directory [java-class-files-home]\com\example.

then you should call the program like this:
java -cp [java-class-files-home] com.example.Hello

where [java-class-files-home] is the base dir where you put the folders which in turn contain the class files

2007-09-25 11:07:50 · answer #2 · answered by minus71 2 · 0 0

If you are running a class file then you need the java development kit (JDK) installed on your computer. The I recommend you download Jcreator to open up the class file.
http://www.jcreator.com/download.htm

Get the Lite version.

If you don't want to use JCreator then you must use command prompt. I'm not quite familiar with the actuall commands but you need to point to the directory of the class file, I forgot what the command for this was. Then you type "javac nameoffile" Replace nameoffile with the name of the file. This will compile the file. Then you type "java nameoffile" which will run it.

2007-09-25 10:11:14 · answer #3 · answered by Luke V 2 · 0 1

hi,

Exception in thread "main" java.lang.NoClassDefFoundError:

If you receive this error, java cannot find your bytecode file,means .class file

One of the places java tries to find your .class file is your current directory. So if your .class file is in directory C:\java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:

cd c:\java

The prompt should change to C:\java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java program and run again.

If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try setting the classpath with the following command.

set CLASSPATH=

Now enter your java program again. If the program works now, you'll have to change your CLASSPATH variable.

2007-09-25 10:43:30 · answer #4 · answered by ashni 2 · 0 0

It is all explained in this link.

Good luck.

2007-09-25 10:22:20 · answer #5 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers