hi!!
my problem is im not able to start java in my pc. i am installing jdk1.5 in my pc n wenever i try to run my program by command
javac example.java
the program compiles bt when i try to intrepet by
java example it shows an error [no main class found]
i m really irritated i changed mu envoirnment variables n tried to do everythng i coud. so plz help!!!!!!!!!!!!!!!!!

Recommended Answers

All 11 Replies

I might be mis-interpreting what your saying, but did you implement a main method in the program you are trying to run?

yup! i did insert a main method
eg:
class tree
{
public static void main(String a[])
{
System.out.println("hi");
}
}
even this program is creatin g an error : tree
this is the problem

Exception in thread "main" java.Lang.NoclassDefFoundError:

What command are you using to execute it?

Try with java -cp . tree

hi im still not able to run my java in my pc. my java is installed in c:\program files\java\jdk1.5.0_0.6\bin. im able to compile my programs bt cannot intrepret. i hv set envoirnmental variables . bt still no help.
even my simplest code doesnot run
eg:
class rat
{
publlic static void main(String a[])
{
System.out.println("hiii");
}
}
im still getting the problems Exception in thread "main" java.Lang.NoClassDefFoundError : rat. plz help me ne1

:sad: hi im still not able to run my java in my pc. my java is installed in c:\program files\java\jdk1.5.0_0.6\bin. im able to compile my programs bt cannot intrepret. i hv set envoirnmental variables . bt still no help.
even my simplest code doesnot run
eg:
class rat
{
publlic static void main(String a[])
{
System.out.println("hiii");
}
}
im still getting the problems Exception in thread "main" java.Lang.NoClassDefFoundError : rat. plz help me ne1
:sad: :sad:

i did javac tree.java for compiling
n java tree for intrepreting

dear its showin a lot of options of java bt not output

check that you have semicolom after java home directory in path variable

c:\program files\java\jdk1.5.0_0.6\bin;

I had problem with that once, on some pc's will run it whitout this semicolom , but other refuse

ps:
not

publlic static void main(String a[])

but

public static void main(String args[])

i did tried wot u said bt still didnt worked n 1 thng public static void main (string args[]) in d place of args we can use anything coz this is an array this u cn try urslf

you can try to set your envoirnmental variables in command,maybe it can help you deal with this problem!Once started I metthe same problem!
1:use "set" to check your "path" and "classpath" settings;
2:set path=c:\....\bin;
set classpath=d:\...; //-your own dir;
3 try again!

!!!when you close your command.exe they will not work,you have to do it again!

wellknown problem for us all
please leave dos and install jGrasp on your machine
than you have someone you can talk to
it's a java-shell and I use it all the time and get supported all the way from texas when I have a problem.

the address : www.jgrasp.com

good luck
peter

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.