This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin and Java


M.K. Choy wrote:
Hi,

I wrote a class file ComeAgain.java with Emacs in Cygwin:

public class ComeAgain
{ private static int n;
    public static void main(String[] args)
   { n = 57;
     System.out.printf("Come in number %d please%n", n);
   }
}

I compiled the script successfully with "javac ComeAgain.java" in Cygwin. But when I try to invoke with "java ComeAgain", I got an error message:

Exception in thread "main" java.lang.NoClassDefFoundError

Do you have any idea why?

Try


java -cp . ComeAgain

If that works, then you have a problem with your CLASSPATH environment variable setting---it needs to include the current directory "."

If that doesn't work, then you may have saved your *.java file in the wrong case. mv it to a different name and then mv it back with the proper capitalization, then recompile and rerun.

HTH,
--
Weiqi Gao
weiqigao@gmail.com
http://www.weiqigao.com/blog/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]