Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33353

Re: Package does not exist only for the packages I create, only on Windows 7

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Package does not exist only for the packages I create, only on Windows 7
Date 2015-12-15 17:45 -0500
Organization A noiseless patient Spider
Message-ID <n4q50q$pqj$1@dont-email.me> (permalink)
References <7b1f4811-ae84-4d4b-9ef1-0d5a076d62f3@googlegroups.com> <n12nka$k1q$1@dont-email.me> <1a336bc9-ebd6-483b-81ff-c391369bdb63@googlegroups.com>

Show all headers | View raw


On 12/15/2015 4:35 PM, Lou wrote:
> [...]
> C:\Users\Lou>echo %CLASSPATH%
> .;C:\Program Files\Java\jdk1.6.0_31\lib;C:\Program Files\Java\jre1.8.0_51\lib;C:\rosas\lou\test;C:\javaclasses\myclasses;C:\javaclasses\LClasses\rosas\lou;C:\javaclasses\LClasses\rosas\lou\clock;C:\javaclasses\LClasses\rosas\lou\weatherclasses;C:\Users\Lou\junit4.10\junit4.10\junit4.10.jar;C:\Users\Lou\junit4.10\junit4.10;C:\javaclasses\OneWireAPI.jar;C:\javaclasses\RXTXcomm.jar;
>
> As an example:
> c:\bin>javac PaceCalculatorMain.java
> PaceCalculatorMain.java:24: package rosas.lou does not exist
> import rosas.lou.*;
> ^
>[...]

     No certain answers, but a few things look odd to me and may be
worth investigating:

     - Ordinarily, each directory on the CLASSPATH is a point from which
       Java begins its search for .class files.  When it searches, Java
       automatically tacks on the package names, so if it's looking for
       rosas.lou.Foo's .class file and the CLASSPATH tells it to begin at
       C:\foo\bar, it will look for C:\foo\bar\rosas\lou\Foo.class.  If
       CLASSPATH says C:\foo\bar\rosas\lou, Java appends rosas and lou
       and winds up with C:\foo\bar\rosas\lou\rosas\lou\Foo.class --
       which is probably not what you wanted.  In your CLASSPATH, the
       C:\rosas\lou\test entry looks suspicious, as do the various
       C:\javaclasses\LClasses\rosas\lou entries.

     - ... except that things are a bit different for JAR files, where
       CLASSPATH should point directly at the JAR that contains the
       desired .class elements.

     - Also, it appears your PaceCalculatorMain.java source file is in
       a directory named C:\bin, which is an odd-sounding place for a
       source file.  Make sure your source files are distributed among
       directories that match the organization of their packages: if
       the class is rosas.lou.PaceCalculatorMain, it should be in a
       file like \...whatever...\rosas\lou\PaceCalculatorMain.java.

     One other thing: Try adding "-verbose" as an option to your javac
command:

	javac -verbose PaceCalculatorMain.java

This will give you a whole ton of output, but you can wade through it
to discover where the compiler finds various classes.  It doesn't, alas,
tell you where the compiler looks when it *fails* to find a class, but
perhaps if you see where it succeeds you'll get an idea of what's amiss.

     Good luck!

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Package does not exist only for the packages I create, only on Windows 7 Lou <lourosas@gmail.com> - 2015-10-31 08:27 -0700
  Re: Package does not exist only for the packages I create, only on Windows 7 Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-31 11:46 -0400
    Re: Package does not exist only for the packages I create, only on Windows 7 Lou <lourosas@gmail.com> - 2015-12-15 13:35 -0800
      Re: Package does not exist only for the packages I create, only on Windows 7 Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-15 17:45 -0500
        Re: Package does not exist only for the packages I create, only on Windows 7 Lou <lourosas@gmail.com> - 2015-12-17 08:22 -0800

csiph-web