www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/13/18:31:44

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_NEUTRAL
X-Spam-Check-By: sourceware.org
Message-ID: <4A5BB5BA.9000205@gmail.com>
Date: Mon, 13 Jul 2009 17:31:22 -0500
From: Weiqi Gao <weiqigao AT gmail DOT com>
User-Agent: Thunderbird 2.0.0.22 (X11/20090608)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin and Java
References: <Prayer DOT 1 DOT 3 DOT 1 DOT 0907132321320 DOT 15960 AT hermes-2 DOT csi DOT cam DOT ac DOT uk>
In-Reply-To: <Prayer.1.3.1.0907132321320.15960@hermes-2.csi.cam.ac.uk>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 AT gmail DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019