IntelliJ & JDK 9

Ivan St. Ivanov at
Mon Dec 22 09:36:58 UTC 2014

Hi Will,

Great job!

We in the Bulgarian Java User Group have spent some time in this direction
as well. You can find a virtual machine with IntelliJ IDEA with the
projects imported on this address:

Our BG JUG fellow Mihail Stoynov is working right now on providing a module
structure that anyone can directly import in IDEA and start working with
OpenJDK. You just need to set a few variables before that.

I couldn't find a way to remove the default jdk module (your step number
7), but still with proper module ordering jdk 8 will be ignored. Once we
have no-rt.jar support in IDEA we'll be able to use the jdk image that we
build from the sources.

To answer your open questions:
- The tests in OpenJDK do not follow a standard setup from a today's
project point of view. You cannot simply import them as a whole in the IDE.
If you insist and have the patience, then I would say that each directory
under jdk/test is a separate test root folder. That is why we decided not
to import them and use tools like gedit to edit the tests. If you want to
run a particular test, then we found that you should use the run external
process functionality and spawn jtreg
- The build system of OpenJDK is make, so we again ignored the compiler
output directories altogether
- This picture
<> is very
useful about the inter-module dependencies. We used that to model the
dependencies when we set up our IntelliJ IDEA project. The JEP-200
<> definition contains very good
explanation on what the different edges and vertices in this graph mean


On Mon, Dec 22, 2014 at 1:22 AM, Will May <will.j.may at> wrote:

> Hi all,
> I've just written a simple script which will generate a project structure
> that can be imported into IntelliJ for JDK9. I've created a PR on github
> against the BuildHelpers repository for the initial version of the script
> but there are possibly issues with this script:
>    - Test directory appears to be a bunch of random test classes in random
>    directories and not packages; I'm not sure how thisb should be seen
> within
>    an IDE.
>    - Modules have been configured to have their compiler output to
>    build/linux-x86_64-normal-server-release/jdk/modules although I'm not
> sure
>    how well IntelliJ and the JDK build system play together.
>    - No inter-module dependencies. Is there any documentation about these
>    dependencies anywhere?
> To use the script with IntelliJ:
>    1. Create a new project
>    2. Select Java, set the project SDK to Java 8 and click next
>    3. Click next (don't create from template)
>    4. Change the project location to jdk9/jdk and click finish
>    5. Once in IntelliJ, open up the project structure settings (File >
>    Project Structure)
>    6. Change the language level to Java 9
>    7. In modules section, remove the default jdk module (answer yes to the
>    popup). Delete the jdk.iml file.
>    8. Run the script now.
>    9. Select all iml files in the project structure, right click and select
>    'Import 47 modules'
> Is there any other functionality that is missing from this script? Can
> someone give my account on the wiki sufficient privileges to document this
> script and also accept my PR on github?
> Cheers,
> Will.

More information about the adoption-discuss mailing list