Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suddenly my java program won't run on jdk1.2? 1

Status
Not open for further replies.

qb828

Programmer
Sep 27, 2000
98
US
hello!
my java programs won't run since yesterday which ran before.

something has to do with my jdk1.2 compiler. it did worked until yesterday. but now none of my java program runs. they all compile but when try to execute them .it gives error message saying"Exception in thread "main"java.lang.NOclassDefFOundError:"myjava file name"
what did i do? now all my java programs won't work which ran before.

even simple helloWorld.java won't run!!!

public class HelloWorld{

public static voic main (String[] args){

System.out.println("Hello World!!");
}}
 
Sounds like your classpath is screwed up.... the java interpreter can't find the class(es) you're trying to execute.

Hope this helps!
 
Hi,

even simple helloWorld.java won't run!!!

public class HelloWorld{

public static voic main (String[] args){

System.out.println("Hello World!!");
}}

The above has different names for "HelloWorld" (helloWorld and HelloWorld). Could that be the problem?

Good Luck,
Pappy
You learn somrthing everyday.
 
hi!
i am sorry about above example, i missed typed "void"
and i did kept my class and file name same (case senstive!)

do you know how to set class path?

is it different than what i i have set in my dos?

i set it as "path=c:\jdk1.3\bin;"
isn't it a class path? is there classpath other than this?


weird thing is that all my programs worked fine til yesterday.

thanks everyone for taking a time to answer my question..

Q
 
Hi,

The classpath variable is a system environment variable listing the paths of your packages and libraries that java bin programs use to find locations of needed classes.

You can try to add the current path (.) to your classpath, under a DOS command line :

$>set classpath=%classpath%;.

then if you have, for example, a Foo class which belongs to the foo package, the file Foo.java will be placed in the mapped .\foo directory.

And then you can launch the optionnal main method of Foo when compiled by :
//Be sure you are in the parent directory of foo
$>java foo.Foo

Bye --
Globos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top