FS#48256 - [pdfsam] need java 8

Attached to Project: Community Packages
Opened by vnoel (kaouete) - Friday, 19 February 2016, 20:18 GMT
Last edited by Evgeniy Alexeev (arcan1s) - Wednesday, 24 February 2016, 20:08 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Evgeniy Alexeev (arcan1s)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hi,

Apparently pdfsam was compiled for Java 8 and can't run with a lower version of Java.

Could we either get a version compiled with Java 7 or force the dependency to java 8 and have an adequate startup script?

When I execute it, I get the following error:
[victor@lasagna ~]$ pdfsam
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/pdfsam/community/App : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
This task depends upon

Closed by  Evgeniy Alexeev (arcan1s)
Wednesday, 24 February 2016, 20:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  3.0.1-4
Comment by vnoel (kaouete) - Saturday, 20 February 2016, 14:04 GMT
  • Field changed: Percent Complete (100% → 0%)
Sorry but that wasn't enough to simply depend on java 8 being installed: it is the case on my system, but then you have to force execute pdfsam with this particular version of java!
Comment by Evgeniy Alexeev (arcan1s) - Saturday, 20 February 2016, 14:24 GMT
Yes, the most common way is to switch default java version via archlinux-java:

https://wiki.archlinux.org/index.php/Java#Switching_between_JVM

Another possible solution run with specified JAVA_HOME, e.g.:

JAVA_HOME=/usr/lib/jvm/java-8-openjdk/jre/ pdfsam

Also please keep in mind that openjdk requires extra/java-openjfx being installed (it is mentioned in opt dependencies). It is possible to patch executable and force JAVA_HOME, but users may want run it with Oracle Java Environment (which has another $JAVA_HOME).
Comment by vnoel (kaouete) - Saturday, 20 February 2016, 14:52 GMT
Yes, I know all of that, I wasn't asking for support but if it was possible to make the package work seamlessly for users.

Your last sentence is at the heart of the problem and the latter may touches more and more packages as Java 8 becomes more and more a requirement for upstream applications.
Maybe this means arch needs some kind of way to discover java versions and their java home... and have archlinux-java set a default implementation for each version...
What do you think the course of action should be now? Forget about it? Open a bug report to answer this general problem in the main arch bugtracker?

It's a complex problem, I underestimated that when I opened the bug report :)

Maybe for now for pdfsam we could at least print some kind of warning at install to explain the situation?
Comment by Eugenio M. Vigo (emvigo) - Sunday, 21 February 2016, 10:19 GMT
Apart from the reasonable suggestions about making OpenJDK 8 the default, for the matter of this specific package, I'd suggest to add java-openjfx as a dependency for pdfsam, as it is a required dependency expected by the program (and code correctness is in our DNA!). Here's the output for executing pdfsam with Java 8 *without* OpenJFX:

[ugi@UGI ~]$ archlinux-java status
Available Java environments:
java-7-openjdk
java-8-openjdk (default)
[ugi@UGI ~]$ pdfsam
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.pdfsam.community.App.main(App.java:34)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more

WITH OpenJFX:
[ugi@UGI ~]$ LANG=C pdfsam
INFO 11:16:36.900 o.p.PdfsamApp[JavaFX-Launcher] Starting PDFsam
INFO 11:16:42.121 o.s.c.c.GlobalConfiguration[JavaFX Application Thread] Configuring Sejda 2.0.0-alpha26
INFO 11:16:44.452 o.p.PdfsamApp[JavaFX Application Thread] Iniciado el 7 seconds
INFO 11:16:46.329 o.p.PdfsamApp[JavaFX Application Thread] Cerrando PDFsam?
Comment by vnoel (kaouete) - Sunday, 21 February 2016, 10:30 GMT
@emvigo: the problem is that it is only needed if it is openjdk that is used! But if someone uses the oracle jre, it is already included in it if I understood well.
Comment by Evgeniy Alexeev (arcan1s) - Tuesday, 23 February 2016, 00:16 GMT
Hi guys,

@emvigo, openjdk requires openjfx, it is mentioned in optional dependency list. In other hand if an user uses Oracle jdk they don't need to install openjfx, because it already provides JFX.

@kaouete, I've pushed 3.0.1-4 to [community-testing] with custom executable script, which should work for most common cases.
Comment by vnoel (kaouete) - Tuesday, 23 February 2016, 08:34 GMT
Thanks so much, it works quite well!

Loading...