1

I'm developing a javafx application using,

  • gradle
  • OpenJdk11
  • OpenJfx11
  • sqlite (It also stored inside main package as sqlite.db)

Now I need to build .deb file for ubuntu installation and .exe file for window installation

build.gradle here

plugins {
    id 'org.openjfx.javafxplugin' version '0.0.8'
}

apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'application'
apply plugin: 'war'

    group = 'dmhashan'

mainClassName = 'dmhashan.payroll.AppStarter'

repositories {
    jcenter()
    mavenCentral()
    mavenLocal()
}

dependencies {
    testImplementation 'junit:junit:4.13'
    implementation 'org.openjfx:javafx:14-ea+2'
    implementation 'com.1stleg:jnativehook:2.0.2'
    implementation 'net.java.dev.jna:jna:5.5.0'
    implementation 'net.java.dev.jna:jna-platform:5.5.0'
    implementation 'com.j256.ormlite:ormlite-core:5.1'
    implementation 'com.j256.ormlite:ormlite-jdbc:5.1'
    implementation 'org.xerial:sqlite-jdbc:3.23.1'
    providedCompile 'com.konghq:unirest-java:3.7.02'
    implementation 'com.konghq:unirest-object-mappers-gson:3.7.02'
}

javafx {
    version = "11.0.2"
    modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.graphics' ]
}

run() {
    jvmArgs = ['--add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED']
}
HiroDev
  • 71
  • 1
  • 6

1 Answers1

1

With just Gradle you can only build an executable JAR that can run on Windows and Linux. To bundle it into an exe or a deb package, you'll need some Gradle plugins.

For the exe, you can use gradle-launch4j.

For the deb, you can sue gradle-ospackage-plugin. You find the documentation here.

Dario Seidl
  • 4,140
  • 1
  • 39
  • 55
  • could you please help me how I need to change above build.gradle for build fat jar (jar file with all libraries and fxml files), plz? – HiroDev Apr 20 '20 at 14:44
  • Maybe this works for you: https://github.com/FibreFoX/javafx-gradle-plugin#minimal-setup-of-buildgradle – Dario Seidl Apr 21 '20 at 21:58