Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: Unable to use package...why ??? Date: Wed, 26 Oct 2011 09:55:18 +0100 Lines: 46 Message-ID: <9gq07mF3mtU1@mid.individual.net> References: <280344ac-b398-44b3-b775-e84859feb5f0@gy7g2000vbb.googlegroups.com> <9gne1vFvskU1@mid.individual.net> <02de641c-1c6a-420b-b059-c17444e1ff3e@g25g2000yqh.googlegroups.com> <9gnn4cFbaqU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net BlqSgAv1GdULebtFNxxDPQcjQ10GpDSfqP6SBm/nOkjv0QDHks Cancel-Lock: sha1:x9rYD3Vy3OV0u7HmgsZR26GVIDI= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9198 On 25/10/11 15:47, markspace wrote: > On 10/25/2011 5:07 AM, Nigel Wade wrote: >> On 25/10/11 12:10, PortisHead wrote: >>> >>> java -cp c:\myclasses Showbcard >>> >> >> That classpath only contains the location of the Getbcard class. It does >> not include the location of Showbcard. Hence java cannot locate the >> Showbcard.class file. > > > > Specifically, you said you put Showbcard in \examples, not \myclasses. > > java -cp c:\myclasses;c:\examples Showbcard > > I don't know how your previous claim that you compiled Showbcard with > the class path of c:\myclasses worked. I think there's a mistake in the > sequence of events you showed us. > > I think the compilation should work because javac locates source files by normal file paths. It doesn't use the classpath to locate the java source files, only the supporting class files. So if you specify the command (as in the OP): javac -cp c:\myclasses Showbcard.java it will compile the Showbcard.java source file in the current directory (no path), and attempt to locate any required classes via the supplied classpath. OTOH java only uses class files, and similarly locates them via the classpath. The supplied classpath in the OP does not include the current directory (as I've already stated twice) so Showbcard.class cannot be found. -- Nigel Wade -- Nigel Wade