wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Class Path Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Class Path Problem" Watch "Class Path Problem" New topic
Author

Class Path Problem

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
Hello Ranchers,

I have a problem in executing the following program

package com;
public class man {

public static void main(String[] args) {
System.out.println("1");
}
}

1. The above program has been saved in c:\projects\source\com\man.java
2. I compiled the above by issuing following command
c:\projects\> javac -d classes source\com\man.java
The output was a successful compilation & the class file was available in c:\projects\classes\com\man.class
3. now when I try to executive the above class
c:\projects\classes\com> java man
I get the following Exception in thread "main" java.lang.NoClassDefFoundError: man

I know that it has got something to do with setting the classpath, but I am not able to figure it out how....please help,

shashank


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Try...

c:\projects\classes>java com.man


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Ravinder Singh
Ranch Hand

Joined: Mar 06, 2006
Posts: 54
try this; it should work:
c:\projects\classes>java -classpath . com.man

----------
Ravinder
Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
Thanks mark, it worked...
 
 
subject: Class Path Problem
 
Similar Threads
problem using javac with -classpath option
Package/sub-package problems...
Java Package
A pain in the ......Please help?
Problem calling a simple program