Link to home
Start Free TrialLog in
Avatar of niti20
niti20

asked on

Exception in thread "main"

i have created a folder com. In this folder i have created the following file


package com; public class Hello {            public static void main(String[] args)       {            System.out.println("Hello World!");      }}



I compile it using
D:\>javac com\Hello.java

But i am unable to run it. i get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: com/Hello


when i do D:\>java com.Hello
Please help
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or if you are running it from d:\ then you an use:

java -classpath . com.Hello

To avoid having to specify it on the command line then add d:\ to your CLASSPATH environment variable