• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

NoClassDefFoundError.....Help

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Im using j2sdk1.4.2_04 in WinXP.
this is my simple class for testing this new version since before I used j2sdk1.4.0;
Ive installed this new version after uninstalling the 1.4.0 completly and after restarting my comp as well.
this works fine whin I compile and run it in j2sdk1.4.2/bin dir
but its not working but only compiling when I put it in any other place,say just in C drive.

I went through the web for get a solution but failed.
it may be somthing wrong with my paths but still I couldnt findout.

here are my environment variables.(system variables)
==========================================================

JAVA_HOME
C:\j2sdk1.4.2

path %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;%JAVA_HOME%\bin;%CATALINA_HOME%\bin

CLASSPATH%CATALINA_HOME%\common\lib\servlet.jar;JAVA_HOME\bin


================ sample program =========================================

import java.io.*;
public class Test1
{
public static void main(String arr[])
{
System.out.println("This is a test");
}
}
=========================================================

I couldnt find anything wrong with these things.
Pls help me on this.
thanks in advance for any comments.
best regs,
Jil.
 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you trying to compile it? Command line or through an IDE tool like JCreator?
 
Jil Nautilus
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using command prompt..
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I gather you are getting a 'Bad command' error or something like that? If so, my suggestion would be to put C:\j2sdk1.4.2\bin into your PATH environment variable. You will then be able to run the various java executables from any directory at the command prompt.
 
Chris Allen
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I should have been a little more specific on the exact path value. For instance, I am using Java 1.4.2_02 and the default installation directory is c:\j2sdk1.4.2_02. Perhaps you should update the path statement to be the exact installation directory (assuming you took the default install which I assume would put it in c:\j2sdk1.4.2_04)?
 
Jil Nautilus
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ive done the same thing with folder name j2sdk1.4.2_04 at the beginning but the result was same.Now I've replaced JAVA_HOME with C:\j2sdk1.4.2_04\bin int the path and the CLASSPATH.I've created a user variable as JAVA_HOME and gave C:\j2sdk1.4.2_04\bin. But the result was same.
Ive been stucked with this problem for two days but still the situation is same.
anyway thanx a lot for your help.
regs,
Jil
 
Chris Allen
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you provide the exact command you are typing in? I reread the thread and don't believe that it is related to path issues but perhaps the way in which you are calling your java application. Typically the NoClassDefFoundError occurs when you try something like the following (assuming the class name is Test1):

java Test1.java
or
java test1.java
or
java Test1.class

In other words, it is trying to load a class file that it can't find. In your case the exact command should be:
java Test1

If you are still getting the same error, my guess is that it still cannot locate the Test1.class file on your harddrive which would lead me back to path issues again. Give it a try and post the response (exactly what you typed and from where).
 
Jil Nautilus
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I did and it works.Someone called "HIWA" from japan send me this.

set PATH=%PATH%;c:\j2sdk1.4.2_04\bin

set CLASSPATh=%CLASSPATH%;.
(The dot is important.)

set JAVA_HOME=c:\j2sdk1.4.2_04

Thanks a lot for your greate support,my friends.
best regards,
Jil
 
Chris Allen
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to see you got it working. Just for reference, the '.' (dot) indicates current directory.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic