Hello.
I look and find that we start here:
http://hg.openjdk.java.net/jdk/jdk/file/b0fcf59be391/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
public Result compile(String[] argv, Context context)
and this leads to:
http://hg.openjdk.java.net/jdk/jdk/file/b0fcf59be391/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
comp.compile(args.getFileObjects(), args.getClassNames(), null, List.nil());
Which leads to genCode:
http://hg.openjdk.java.net/jdk/jdk/file/b0fcf59be391/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaFileObject genCode(Env env, JCClassDecl cdef) throws
IOException
Which calls:
return writer.writeClass(cdef.sym);
And so I think if I've understood you (without a debugger running on this end)
the JavaCompiler (in Java) will do a C compile on various C source code
documents and share libraries and this will make the native binary "javac". Is
that correct?
The file "javac" is a native binary that is produced with a JavaCompiler called
from the "bash configure && make all" command?
Thanks!
😊 MR/
From: Erik Joelsson
Sent: Friday, July 20, 2018 6:56 PM
To: mr rupplin; build-dev@openjdk.java.net
Subject: Re: Short Question - About javac.c where is it?
Hello Max,
Javac, like most of the command line tools in the JDK is written in
Java, so to look at the actual program, I would recommend starting here
(assuming current mainline at http://hg.openjdk.java.net/jdk/jdk):
src/jdk.compiler/share/classes/com/sun/tools/javac/Main.java
Most of the executables in the JDK are built from the same launcher src
file with some different -D macro flags set to control which java class
gets invoked by that launcher. The source for the launchers is located here:
src/java.base/share/native/launcher/main.c
Does that answer your question?
/Erik
On 2018-07-20 15:31, mr rupplin wrote:
> In building the OpenJDK where may we find the source code file(s) for the
> javac output?
>
> In libjli we find the java.c but locate javac.c returns no results. How
> curious.
>
> Would you be a friend and help us out. We love reading.
>
> Thanks,
>
> Max
>
> /sr software developer