Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge 880a97b into db84a6c
Browse files Browse the repository at this point in the history
  • Loading branch information
fzdy1914 committed Apr 11, 2019
2 parents db84a6c + 880a97b commit 09f468b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Expand Up @@ -35,6 +35,6 @@ endif::[]

* Some parts of this sample application were inspired by the excellent http://code.makery.ch/library/javafx-8-tutorial/[Java FX tutorial] by
_Marco Jakob_.
* Libraries used: https://github.com/TestFX/TestFX[TestFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/junit-team/junit5[JUnit5]
* Libraries used: https://github.com/javafxports/openjdk-jfx[JavaFX], https://github.com/TestFX/TestFX[TestFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/junit-team/junit5[JUnit5]

== Licence : link:LICENSE[MIT]
28 changes: 27 additions & 1 deletion build.gradle
Expand Up @@ -2,8 +2,18 @@
// For more details take a look at the Java Quickstart chapter in the Gradle
// user guide available at http://gradle.org/docs/5.2.1/userguide/tutorial_java_projects.html

import org.apache.commons.lang3.SystemUtils
import org.gradle.api.tasks.testing.logging.TestLogEvent

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
}
}

plugins {
id 'java'
id 'jacoco'
Expand All @@ -15,7 +25,7 @@ plugins {
}

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

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -41,9 +51,25 @@ test {
useJUnitPlatform()
}

String platform = SystemUtils.IS_OS_WINDOWS ? 'win'
: SystemUtils.IS_OS_LINUX ? 'linux'
: SystemUtils.IS_OS_MAC ? 'mac'
: null
if (platform == null) {
throw new RuntimeException('The current OS is not supported.')
}

dependencies {
String testFxVersion = '4.0.15-alpha'
String jUnitVersion = '5.1.0'
String javafxVersion = '11'

implementation group: 'org.openjfx', name: 'javafx-base', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-controls', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-media', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: platform

implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'
Expand Down
2 changes: 1 addition & 1 deletion config/checkstyle/checkstyle.xml
Expand Up @@ -26,7 +26,7 @@
</module>

<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppressions.xml"/>
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>


Expand Down
27 changes: 27 additions & 0 deletions src/main/java/seedu/address/Main.java
@@ -0,0 +1,27 @@
package seedu.address;

import javafx.application.Application;

/**
* The main entry point to the application.
*
* Addressbook is unable to run in a jdk11 environment using MainApp class
* directly and it gives an error of below:
*
* Error: JavaFX runtime components are missing, and are required to run this application
*
* This error comes from sun.launcher.LauncherHelper in the java.base
* module. The reason for this is that the Main app extends Application
* and has a main method. If that is the case, the LauncherHelper will
* check for the javafx.graphics module to be present as a named module.
* If that module is not present, the launch is aborted.
*
* One simple workaround is to have a separate main class that doesn't
* extend Application. Hence it doesn't do the check on javafx.graphics
* module, and when the required jars are on the classpath, it works fine.
*/
public class Main {
public static void main(String[] args) {
Application.launch(MainApp.class, args);
}
}
6 changes: 1 addition & 5 deletions src/main/java/seedu/address/MainApp.java
Expand Up @@ -32,7 +32,7 @@
import seedu.address.ui.UiManager;

/**
* The main entry point to the application.
* Runs the application.
*/
public class MainApp extends Application {

Expand Down Expand Up @@ -180,8 +180,4 @@ public void stop() {
logger.severe("Failed to save preferences " + StringUtil.getDetails(e));
}
}

public static void main(String[] args) {
launch(args);
}
}

0 comments on commit 09f468b

Please sign in to comment.