Using an IDE to work on the Java library

Robbin Ehn robbin.ehn at oracle.com
Wed Jun 7 20:31:54 UTC 2017


On 06/07/2017 07:25 PM, Thomas Stüfe wrote:
> 
> 
> On Wed, Jun 7, 2017 at 2:34 PM, Robbin Ehn <robbin.ehn at oracle.com <mailto:robbin.ehn at oracle.com>> wrote:
> 
>     On 2017-06-05 18:51, Andrew Dinn wrote:
> 
>         On 05/06/17 17:30, Andrew Haley wrote:
> 
>             Sorry for what must seem like a newbie question...
> 
>             I've done almost all of my work on HotSpot, and have very little
>             experience trying to use an IDE to work on the Java library.  Eclipse
>             is fine when working on libraries outdie the JDK itself, but seems to
>             want to look inside src.zip for its sources when debugging.  It would
>             be really nice to be able to see (and edit) the real Java source files
>             in jdk/java.base/.
> 
>             I suppose there must be some way to create a Project for an IDE, so
>             that debugging the standard library is easy.  Is there some advice
>             around somewhere?  What do people do?
> 
> 
>         I use IntelliJ Idea. The latest releases cope quite happily with jdk9/10.
> 
> 
>     If you are a vim guy, I can recommend IntelliJ with the vim plugin.
> 
> Does working on the OpenJDK sources require the full version or do you use the Community Edition?

I have only tried full version, so I can't say.

/Robbin

> 
> ..Thomas
> 
> /Robbin
> 
> 
> 
>     In the project settings you can set up a JDK you build from scratch as a
>     project JDK and the sources located in the build image (in src.zip) will
>     be picked up automatically by Idea.
> 
>     In order to see sources not in src.zip you need to add the jdk source
>     tree to the project's main module as a source root (do this from the
>     "open module settings" or "project structure" dialogs). Likewise, if you
>     want the jdk.vm.ci <http://jdk.vm.ci> sources for graal from the hotspot tree. So, for the
>     latter case, I add jdk9/jdk/hotspot/src/jdk.internal.vm.ci <http://jdk.internal.vm.ci> as a source
>     root. (Alternatively you can add it to an extra module that then gets
>     inherited by the project module(s)).
> 
>     You then have to tag the relevant module subdirs in these added trees as
>     src directories to bring the desired source files into play. For example
>     for the jdk.vm.ci <http://jdk.vm.ci> sources root I tag share/classes/jdk.v.ci.code/src etc
>     as source dirs. Once again this is done from the "open module settings"
>     dialog.
> 
>     Note that you can configure the module settings for app modules (or for
>     any common extra module you add and then make them inherit) so that
>     these extra  sources are picked up prior to any sources or (what you
>     don't want) class files obtained from the project JDK.
> 
>     regards,
> 
> 
>     Andrew Dinn
>     -----------
>     Senior Principal Software Engineer
>     Red Hat UK Ltd
>     Registered in England and Wales under Company Registration No. 03798903
>     Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
> 
> 


More information about the jdk10-dev mailing list