Creating a package that requires Java 16

I am trying to define an xbps-src template for logisim-evolution, a Java app that requires Java 16. I am using depends="virtual?java-runtime" and, as expected by reading etc/defaults.virtual, OpenJDK 8 is used. Creating a etc/virtual file is ignored in .gitignore, so I guess it is made to be used with local packages. Using depends="virtual?java-runtime-17.0.5+7_1" works, as OpenJDK 17 provides that exact version of java-runtime. If it were updated, this package would break, because if I input a lower version, it will fail. I've tried using syntax like > and >=, but then I get the following error:

=> ERROR: logisim-evolution-3.8.0_1: failed to resolve virtual dependency for 'virtual?java-runtime>=16.0.2+7' (missing from etc/virtual)

Should I just set OpenJDK17 as a dependency (contrary to what other packages are doing)? I've researched the best I could and still can't figure this out. Could anyone with more xbps knowledge help me out? Thanks in advance.

Posted Jan 11, 2023, 7:21 PM UTC

12
ClassAbbyAmplifier•

if it needs a specific version, don't use the virtual package, just use openjdk17-jre. if it has some launcher script, you'll want to hard-code the JAVA_HOME or similar so it doesn't use the wrong java version

1
VoidbertOP•

Thanks! I was hesitant to use open JDK directly because it seems like a bad practice (when void gets, for example, JDK 19, that would work but the package would still force users to use version 17) and I found very few packages that did that. Also, thank you for the JAVA_HOME tip, I completely forgot about it.

1