• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Strange Error...

 
Greenhorn
Posts: 10
  • 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.0
when Im compiling this small class it get compiled.
when I try to execute it it gave me an error saying,

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

Whats wrong with this???
Pls help me to clarify this strange error...

Thanx in advance for any comments,
best regs,
Jayanath.

import java.io.*;
public class test
{
public static void main(String arr[])
{
System.out.println("testing ");
}
}
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set ur classpath to current directory. which means execute the following on the command prompt

set CLASSPATH=.;%CLASSPATH%;

note: use ';' if ur working on windows and ':' if ur working on linux

now it should work fine
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to Java in General (Beginner) for follow-ups.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
well, it seems you have not set your classpath and if u did so check r u storing your file with a same name as of class as "test.java".sumtimes while working with notepad u have to store file with double quotes like "test.java" while saving because sumtimes if u store file as test.java in notepad then the filename might be taken up as test.java.txt...so keep this too in mind.

hope it solves your problem..all the best..
seema
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As suggested above, I'd bet your CLASSPATH value could use changing. For an explanation of just what the CLASSPATH is, as well as for instructions on how to set it on different operating systems, take a look at our FAQ on HowToSetTheClasspath.
 
reply
    Bookmark Topic Watch Topic
  • New Topic