wood burning stoves
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

Class Path Problem

Nikhil Jain
Ranch Hand

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

I have a problem in executing the following program

package com;
public class man {

public static void main(String[] args) {

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,


SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+
marc weber

Joined: Aug 31, 2004
Posts: 11343


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
Ravinder Singh
Ranch Hand

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

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 389
Thanks mark, it worked...
I agree. Here's the link: http://aspose.com/file-tools
subject: Class Path Problem
It's not a secret anymore!