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

i set path and all
now java -version command is working and when i try to compile i am getting the error of
Exception in thread "main" java.lang.NoClassDefFoundError
can anybody help me

2006-11-08 19:38:22 · 4 answers · asked by Anonymous in Computers & Internet Software

4 answers

Have you actually compiled your class(es)? You need to compile your class(es) using javac.exe.

If they are compiled already (you see the .class files), then it is a classpath problem. If you run the java command from the top-most directory of where your packages are located, then you don't need to do anything. If not, or if you have sets of classes in different directories, you need to set the classpath environment variable to point to them.

Example (assumes Windows): assume you have your main class and classes in c:\projects\Main, and you have additional utility classes in c:\projects\Utilities. Then you need to add those two directories to your classpath. You can do this permanently by setting the Windows environment variables, like you do for *path*, or you can do it in the shell (command prompt) for temporary:
c:\dev> set classpath=c:\projects\Main;c:\projects\Utilities

Also, it is pretty useful to prepend the path with "." to include the "current directory" (wherever you happen to be). I often put this info into a batch file so I don't have to type it over and over. This way, you can try running one set of classes against differing sets, just by choosing a different batch file.

2006-11-09 03:27:44 · answer #1 · answered by vincentgl 5 · 0 0

u need to save ur class file(the main program) in the folder where bin is.

if bin s in C:\Program Files\Java\jdk1.5.0_08\bin

then ur program should be saved in the same location
ie C:\Program Files\Java\jdk1.5.0_08\bin

set the path n command prompt to the same
ie C:\Program Files\Java\jdk1.5.0_08\bin

now type javac prgname.java

then java prgname

2006-11-08 20:08:36 · answer #2 · answered by aravind 3 · 0 1

i have virtually forgetten this. yet i imagine that's javac filename.java first you need to discover the folder the report is in first. enable's say you kept it in C:javastuff. make certain the line on the exhibit screen starts with: C:javastuff>

2016-10-16 08:15:19 · answer #3 · answered by ? 4 · 0 0

Yeah It's having trouble with Classes something might be wrong with your code.

2006-11-08 19:43:30 · answer #4 · answered by jack 6 · 0 2

fedest.com, questions and answers