FS#64060 - [pdfsam] please switch to depend on java-runtime

Attached to Project: Community Packages
Opened by tinywrkb (tinywrkb) - Monday, 07 October 2019, 19:30 GMT
Last edited by Toolybird (Toolybird) - Saturday, 29 April 2023, 01:08 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Evgeniy Alexeev (arcan1s)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Is there a reason for pulling in jdk?
Please switch from java-environment depend to java-runtime.
This task depends upon

Closed by  Toolybird (Toolybird)
Saturday, 29 April 2023, 01:08 GMT
Reason for closing:  Won't fix
Additional comments about closing:  Dropped to the AUR January '21.
Comment by Felix Salazar (phollox) - Thursday, 04 June 2020, 13:16 GMT
I just installed PDFsam on an updated arch box. It does not start, and throws the following error
$ pdfsam
Run with exported
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/pdfsam/basic/App has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)


I have installed jre-openjdk and jre8-openjdk. Hence, the Java dependencies are not correct
Comment by tinywrkb (tinywrkb) - Thursday, 04 June 2020, 13:49 GMT
@phollox I don't know why you post here but it tells you in the error message that you need "class file version 55.0" and it means at least Java 11 version. As according to you comment you apparently have multiple Java versions installed then you need to set the active one with archlinux-java according to https://wiki.archlinux.org/index.php/Java#Switching_between_JVM

If you look at pdfsam depends you'll notice the java-environment>=11 requirement.

But I recommend just dropping pdfsam completely, try pdfmixtool instead which is pretty great, and in its latest 0.6 release added the alternative mix feature which was the main reason I used pdfsame.
Comment by Keil Miller Jr (keilmillerjr) - Saturday, 28 November 2020, 14:12 GMT
Thank you @phollox and @tinywrkb. I had the same exact error, seem when launching pdfsam from terminal. The wrong java runtime was selected. For reference, I posted the commands that got me there, obtained from previously posted link.

```
➜ ~ archlinux-java status
Available Java environments:
java-14-openjdk
java-8-openjdk/jre (default)
➜ ~ archlinux-java set java-14-openjdk
This script must be run as root
➜ ~ sudo archlinux-java set java-14-openjdk
[sudo] password for keiljr:
➜ ~ archlinux-java status
Available Java environments:
java-14-openjdk (default)
java-8-openjdk/jre
```

Loading...