Ask Your Question

Libreoffice can't find Java on ubuntu server

asked 2019-06-07 13:57:45 +0200

maribov gravatar image

updated 2019-06-07 14:26:15 +0200

I'm trying to run the following command using Symfony inside of a controller that I have (laravel):

"soffice --safe-mode --convert-to pdf store/file.docx --headless

It works in commandline but not when run through the controller. I thought it might be a permissions issue at first but now I keep getting this error about java:

Exit Code: 77(Unknown error)↵↵Working directory: /var/www/project/public↵↵Output:↵================↵↵↵Error Output:↵================↵javaldx failed!↵Warning: failed to read path from javaldx↵LibreOffice 6.2 - Fatal Error: The application cannot be started. ↵User installation could not be completed. ↵" trace: [{function: "getHigherPDF", class: "App\Http\Controllers\AssessmentController", type: "::"},…]

so I'm thinking that it can't find java for some reason? Where can I update the path to my correct instance of java if that's the issue?

When i do which libreoffice it says i'm using /usr/bin/libreoffice, but when i try to find a place to updat the java path in there I'm afraid to edit because it's not super clear where the path is defined

edit: i've tried installing libreoffice-base and it didn't help

edit retag flag offensive close merge delete


Some questions, and no guarantee that answering them would help at all.

  • Why --safe-mode?
  • Why Java is needed at all? do you have Java-dependent plugins with your LibreOffice? otherwise, for a docx import and pdf export, there shouldn't be a need for Java.
  • How is LibreOffice installed? PPA? Snap? TDF DEB?
Mike Kaganski gravatar imageMike Kaganski ( 2019-06-07 15:38:41 +0200 )edit
  • I was attempting to use --safe-mode because of a certain thread I found where someone was having a similar error, but i get the same result without --safe-mode as well, it made no difference
  • I don't think I DO need Java, but I get this error even though all i'm running is the pdf convert. is there a way to have libreoffice stop looking for java completely?
  • I installed it using ppa
maribov gravatar imagemaribov ( 2019-06-07 15:51:50 +0200 )edit

@Mike Kaganski I see here that there is a way to turn off java for libreoffice through the gui, is there a way to turn it off via terminal if I'm running it on a remote server where I can't have a gui?

maribov gravatar imagemaribov ( 2019-06-07 16:22:10 +0200 )edit

Posted an answer a few days back to help resolve a similar error. Don't know if it solved that problem, or if it'll solve this one, but it might help...

techsquirrel gravatar imagetechsquirrel ( 2019-06-07 18:51:51 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-06-08 01:47:03 +0200

maribov gravatar image

I had to give www-data the correct home directory!!

$process = new Process("HOME=".getCWD()." && export HOME && libreoffice --headless --convert-to pdf store/mar_maribov_higher_results.docx --outdir store"); $process->run(); return $path_copy_pdf;

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-06-07 13:57:45 +0200

Seen: 505 times

Last updated: Jun 08 '19