Skip to content

Commit

Permalink
Warn developers against using JDK 10 on Windows
Browse files Browse the repository at this point in the history
Due to a JavaFX bug[1], JDK 10 on Windows will fail to run tests in
headless mode.

As such, let's warn developers against using JDK 10 on Windows in our
documentation, and recommend that they use JDK 9 instead.

Some developers who have both JDK 9 and JDK 10 installed on their
systems may have trouble coaxing Gradle to use JDK 10. As such, to make
it easier to troubleshoot the setup of such developers, let's teach
build.gradle to print a warning to console if it detects that it is
running with JDK 10 on Windows.

[1] javafxports/openjdk-jfx#66
  • Loading branch information
pyokagan committed Jun 30, 2018
1 parent 7d85026 commit e8668d8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ plugins {
id 'application'
}

if (JavaVersion.current() == JavaVersion.VERSION_1_10
&& System.getProperty('os.name').startsWith('Windows')) {
logger.warn('''\
==============================================================================
*********************************** WARNING **********************************
==============================================================================
You seem to be running Gradle with JDK 10 on Windows.
JDK 10 on Windows will fail to run tests in headless mode due to a JavaFX bug.
You are highly recommended to use JDK 9!
==============================================================================
'''.stripIndent())
}

// Specifies the entry point of the application
mainClassName = 'seedu.address.MainApp'

Expand Down
6 changes: 6 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:warning-caption: :warning:
endif::[]
:repoURL: https://github.com/se-edu/addressbook-level4/tree/master

Expand All @@ -19,6 +20,11 @@ By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT`
=== Prerequisites

. *JDK `9`* or later
+
[WARNING]
JDK `10` on Windows will fail to run tests in <<UsingGradle#Running-Tests, headless mode>> due to a https://github.com/javafxports/openjdk-jfx/issues/66[JavaFX bug].
Windows developers are highly recommended to use JDK `9`.

. *IntelliJ* IDE
+
[NOTE]
Expand Down
6 changes: 6 additions & 0 deletions docs/UsingGradle.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:warning-caption: :warning:
endif::[]

https://gradle.org/[Gradle] is a build automation tool. It can automate build-related tasks such as
Expand Down Expand Up @@ -75,6 +76,7 @@ Runs the code style check for the test code base

The set of code style rules implemented can be found in `config/checkstyle/checkstyle.xml`. To enable _exceptions_ to code styles, add in the comment `//CODESTYLE.OFF: RuleName` at the start of the section and `//CODESTYLE.ON: RuleName` at the end of the section.

[[Running-Tests]]
== Running Tests

* **`allTests`** +
Expand All @@ -86,6 +88,10 @@ Runs all non-GUI tests in the `seedu.address`
package
* **`headless`** +
Sets the test mode as _headless_. The mode is effective for that Gradle run only so it should be combined with other test tasks.
+
[WARNING]
JDK `10` on Windows will fail to run tests in headless mode due to a https://github.com/javafxports/openjdk-jfx/issues/66[JavaFX bug].
Windows developers are highly recommended to use JDK `9`.

Here are some examples:

Expand Down

0 comments on commit e8668d8

Please sign in to comment.