caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.14k stars 260 forks source link

jpackage support for VLCJ #1035

Closed courteous closed 3 years ago

courteous commented 3 years ago

I have vlcj 4.7 + javafx app that is working just fine when runned in IDE (using openjdk 15.0.2 2021-01-19 i.e. https://download.java.net/java/GA/jdk15.0.2/0d1cfde4252546c6931946de8db48ee2/7/GPL/openjdk-15.0.2_linux-x64_bin.tar.gz).

Now i wanted to package this app using jpackage winch is the default packaging tool now for java i.e. create msi,exe,deb etc.

However when running mvn javafx:jlink

i get the error " Error: automatic module cannot be used with jlink: uk.co.caprica.vlcj from file:///home/dude/.m2/repository/uk/co/caprica/vlcj/4.7.0/vlcj-4.7.0.jar " I did tried using vlcj 4.7.0 and compiling my own 5.0.0-SNAPSHOT locally. But non of those are modular.

then i tried patching the jar itself like this


jdeps --ignore-missing-deps --generate-module-info jars vlcj-4.7.0.jar

javac --patch-module uk.co.caprica.vlcj=vlcj-4.7.0.jar  jars/uk.co.caprica.vlcj/module-info.java

~/.m2/repository/uk/co/caprica/vlcj/4.7.0$ jar uf vlcj-4.7.0.jar -C jars/uk.co.caprica.vlcj/ module-info.class
java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 59.0
        at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1092)
        at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:196)
        at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:148)
        at java.base/java.lang.module.ModuleDescriptor.read(ModuleDescriptor.java:2574)
        at jdk.jartool/sun.tools.jar.Main.addExtendedModuleAttributes(Main.java:2079)
        at jdk.jartool/sun.tools.jar.Main.update(Main.java:1013)
        at jdk.jartool/sun.tools.jar.Main.run(Main.java:366)
        at jdk.jartool/sun.tools.jar.Main.main(Main.java:1676)

but that also did not work.

another post that is relevant is this

897

In the above mentioned post another use mentioend that the simple fix is just addin

requires vlcj;

in module-info.java , but that is not the case

in my module-info.java look like this now

module org.test {
    requires javafx.controls;
    requires javafx.media;
    requires javafx.graphics;
    requires javafx.web;
    requires javafx.fxml;

    //requires com.sun.jna;
    requires java.rmi;

    requires uk.co.caprica.vlcj;
    requires uk.co.caprica.vlcj.javafx;
    //requires vlcj.natives;
//  requires vlcj;

    exports org.test;

    opens org.test to javafx.fxml;
    opens org.controllers to javafx.fxml;
}

My question since officially jpackage does not support automatic modules . Is there a way for vlcj any version to be used with jpackage.

caprica commented 3 years ago

The Java Module System is total garbage IMO. It adds way too much work and complexity to make it worthwhile for what real-world benefit I have yet to see.

I have been down this path already with vlcj and it was not a fun experience.

Now, having said that, if someone tells me there are some simple things that can be done in vlcj to help people like you with these things you need, I'm all for it.

So let's see some PR's and we'll see.

But I will not personally spend any more time debugging or dealing with the difficulties imposed by the Java Module System - like I said, I have already been down that path.

caprica commented 3 years ago

This part at least is a "you" problem :-)

~/.m2/repository/uk/co/caprica/vlcj/4.7.0$ jar uf vlcj-4.7.0.jar -C jars/uk.co.caprica.vlcj/ module-info.class
java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 59.0

Version 59 is Java 15.

vlcj is compiled with Java 8, so modules can't be supported anyway, right? Modules are a Java 9 feature?

I had numerous complaints when I tried to push vlcj past Java 8.

caprica commented 3 years ago

Maybe some workaround here: https://github.com/dlemmermann/JPackageScriptFX