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


Groups > comp.lang.java.help > #2983

Re: How does Javac find source code?

From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.help
Subject Re: How does Javac find source code?
Date 2014-08-05 17:48 -0400
Organization A noiseless patient Spider
Message-ID <lrrjgh$rki$1@dont-email.me> (permalink)
References <mlg0u9lpiq8rmquc5eimokjlicb2vkh9s9@4ax.com>

Show all headers | View raw


On 08/04/2014 10:41 PM, Roedy Green wrote:
> Back in the days of Java 1.0 I figured out how Javac.exe and Java.exe
> find their source code and classes on the sourcepath/classpath.
>
> However one mystery has remained. The question is not a practical one,
> just a minor irritant.
>
> Java insists you put each public class in its own source code file
> with a name matching the class and the directory structure matching
> the package. This is how Java can find the source for a class it
> needs. It can generate the source code file name.
>
> However, you are permitted to include  a non-public top-level class in
> the same source file as a public class. How then does Java find that
> non-public class?
>
> Does it just search all the *.java files in that package?
> Does it postpone looking for it until it has loaded all the top level
> classes it wants, and hope it finds it by serendipity?
>
You might try the Hitchhiker's Guide to start.
<http://openjdk.java.net/groups/compiler/doc/hhgtjavac/index.html>

Back to comp.lang.java.help | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How does Javac find source code? Roedy Green <see_website@mindprod.com.invalid> - 2014-08-04 19:41 -0700
  Re: How does Javac find source code? Jeff Higgins <jeff@invalid.invalid> - 2014-08-05 17:48 -0400

csiph-web