-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hi, run task works fine, but when running the executable generated by jpackage task i got openCV errors. There are this lib called 'dcm4che' that uses opencv to decompress medical images, and i need to add opencv path to the java.library.path, what is wrong?
this is build.gradle file:
plugins {
id "java"
id "application"
id "org.openjfx.javafxplugin" version "0.0.13"
id "org.beryx.jlink" version "2.25.0" //https://github.com/beryx/badass-jlink-plugin
id "org.javamodularity.moduleplugin" version "1.8.12"
}
group "com.webkriativa.noahviewer"
version "0.5"
var lwjglNativesPath = "libs/lwjgl";
var dcm4cheVersion = "5.31.2"
var dcm4chePath = "libs/dcm4che-" + dcm4cheVersion;
var openCVNativesWindowsPath = dcm4chePath + "/lib/windows-x86-64"
project.ext.lwjglVersion = "3.3.3"
project.ext.lwjglNatives = "natives-windows"
repositories {
mavenCentral()
maven {
url = uri("https://maven.scijava.org/content/repositories/public/")
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
application {
mainModule = "com.webkriativa.noahviewer"
mainClass = "com.webkriativa.noahviewer.Main"
}
javafx {
version = "17.0.6"
modules = ["javafx.controls", "javafx.fxml", "javafx.graphics"]
}
dependencies {
....a lot of lines...
}
tasks.jpackageImage.doLast {
copy {
from("src/main/resources")
into("$buildDir/jpackage/$project.name/src/main/resources")
}
copy {
from "libs"
into("$buildDir/jpackage/$project.name/libs")
}
}
jlink{
forceMerge('log4j-api')
forceMerge('slf4j-api-2.0.9')
mergedModule {
additive = true
uses 'org.apache.logging.log4j.util.PropertySource';
uses 'org.apache.logging.log4j.spi.Provider';
uses 'org.apache.logging.log4j.message.ThreadDumpMessage.ThreadInfoFactory';
}
jpackage {
if (org.gradle.internal.os.OperatingSystem.current().windows) {
installerOptions += ['--icon', 'src/main/resources/images/logo.ico']
imageOptions += ['--win-console']
imageOptions += ['--resource-dir', 'src/main/resources']
icon = "src/main/resources/images/logo.ico"
skipInstaller = true
}
}
launcher{
jvmArgs = ['-Djava.library.path="' + lwjglNativesPath + ";" + dcm4chePath + ';' + openCVNativesWindowsPath + '"',
'--add-opens', 'java.desktop/javax.imageio.stream=dcm4che.imageio.opencv',
'--add-opens', 'java.base/java.io=dcm4che.imageio.opencv']
}
}
run {
jvmArgs = ['-Djava.library.path="' + lwjglNativesPath + ";" + dcm4chePath + ';' + openCVNativesWindowsPath + '"',
'--add-opens', 'java.desktop/javax.imageio.stream=dcm4che.imageio.opencv',
'--add-opens', 'java.base/java.io=dcm4che.imageio.opencv']
}
error:
org.opencv.osgi.OpenCVNativeLoader init
Successfully loaded OpenCV native library.
java.lang.NullPointerException: Cannot invoke "org.dcm4che3.opencv.StreamSegment.getImageDescriptor()" because "seg" is null
this error occurs only when not using the "--add-opens", why add-opens in jvmArgs has not effect in the exe?
Metadata
Metadata
Assignees
Labels
No labels