3

I have the following versions of OpenJDK installed:

java-1.11.0-openjdk-amd64      1101       /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64

I get the following error using PDFsam in Lubuntu 18.04:

INFO   [12:15:47]: Starting PDFsam
INFO   [12:15:48]: Transparent windows not supported by the platform
INFO   [12:15:48]: Configuring Sejda 3.2.38
INFO   [12:15:48]: Gestarted in 1 second
INFO   [12:15:57]: 3.pdf loaded
INFO   [12:15:57]: 4.pdf loaded
INFO   [12:15:57]: 5.pdf loaded
INFO   [12:15:58]: Starting task (org.sejda.impl.sambox.MergeTask@81b1817) execution.
WARN   [12:15:59]: New fonts found, font cache will be re-built
WARN   [12:15:59]: Building on-disk font cache, this may take a while
ERROR  [12:15:59]: Unexpected error
java.lang.NoClassDefFoundError: Could not initialize class org.sejda.sambox.pdmodel.font.PDType1Font
at org.sejda.impl.sambox.util.FontUtils.<clinit>(FontUtils.java:74)
at org.sejda.impl.sambox.component.PDDocumentHandler.close(PDDocumentHandler.java:231)
at org.sejda.common.ComponentsUtility.nullSafeClose(ComponentsUtility.java:63)
at org.sejda.common.ComponentsUtility.nullSafeCloseQuietly(ComponentsUtility.java:49)
at org.sejda.impl.sambox.MergeTask.closeResources(MergeTask.java:232)
at org.sejda.impl.sambox.MergeTask.after(MergeTask.java:237)
at org.sejda.core.service.DefaultTaskExecutionService.actualExecution(DefaultTaskExecutionService.java:151)
at org.sejda.core.service.DefaultTaskExecutionService.execute(DefaultTaskExecutionService.java:71)
at org.sejda.core.service.DefaultTaskExecutionService.execute(DefaultTaskExecutionService.java:58)
at org.pdfsam.task.TaskExecutionController.lambda$request$0(TaskExecutionController.java:87)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
  • 1
    How did you installed pdfsam? – N0rbert Jul 18 '18 at 10:21
  • 1
    With 'sudo apt-get install pdfsam'. – Ben Jul 18 '18 at 10:28
6

It is known bug bug 1768565 on the LaunchPad about broken compatibility between OpenJDK 11 and PDFSaM Ubuntu package.

I found working solution. We should remove pdfsam Ubuntu-package and download pdfsam-basic from official site:

sudo apt-get purge pdfsam
sudo apt-get autoremove
cd ~/Downloads
wget https://github.com/torakiki/pdfsam/releases/download/v4.0.1/pdfsam_4.0.1-1_all.deb
sudo apt-get install ./pdfsam_4.0.1-1_all.deb

This is not first time, as Scilab was broken by Java too (see this Q&A).
So Ubuntu 18.04 LTS is not yet ready for enterprise and educational deployment.

  • Let us continue this discussion in chat. – Ben Jul 18 '18 at 20:59
  • 1
    I fixed the problem. Please see updated answer. We do not need to patch any file and do not need to override Java versions. So I removed my previous comments as out-of-date. – N0rbert Jul 18 '18 at 21:26
  • 1
    This works for me, so long as I set the java version to "8" with: sudo update-alternatives --config java It would be nice if there was no need to tweak java versions (as another comment suggests), but unfortunately that's not the case for me. (But the version installed from PPA wouldn't work at all, so this is definitely preferable!) – Dɑvïd Aug 30 '18 at 11:16
1

Solution is here:

https://bugs.launchpad.net/ubuntu/+source/pdfsam/+bug/1768565

The bug is fixed in Ubuntu 18.04 (Bionic Beaver 64 bit) once the default java version is set to java-8. No need to downgrade or uninstall java-10 or java-11. The default java is java-11 for Ubuntu 18.04. PDFSAM basic 3.35 or 3.37 is written in java-8 and will work with java-8 only.

Tested on PDFSAM Split and Merge Basic Edition 3.3.5 OpenJDK Runtime Environment 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13

Run in terminal sudo update-alternatives --config java

Select/type 2 (or whatever serial number is shown against java-8). The press Enter to set the default java version to java-8.

protected by N0rbert Feb 3 at 6:14

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.