From 98edbfb02ac313821e3f787a025a71d64830dafc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Morales=20de=20Luna?= Date: Mon, 20 Jan 2020 21:37:47 +0100 Subject: [PATCH] Fix opening pdf with okular in linux (#5253) --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/desktop/os/Linux.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62fca1b2de1..5f258dd514d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Fixed +- We fixed and issue where pdf files will not open under some KDE linux distributions when using okular. [#5253](https://github.com/JabRef/jabref/issues/5253) - We fixed an issue where the Medline fetcher was only working when JabRef was running from source. [#5645](https://github.com/JabRef/jabref/issues/5645) - We fixed some visual issues in the dark theme. [#5764](https://github.com/JabRef/jabref/pull/5764) [#5753](https://github.com/JabRef/jabref/issues/5753) - We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779) diff --git a/src/main/java/org/jabref/gui/desktop/os/Linux.java b/src/main/java/org/jabref/gui/desktop/os/Linux.java index dd45135a6b1..e6fbcfc9fe0 100644 --- a/src/main/java/org/jabref/gui/desktop/os/Linux.java +++ b/src/main/java/org/jabref/gui/desktop/os/Linux.java @@ -30,7 +30,11 @@ public void openFile(String filePath, String fileType) throws IOException { viewer = "xdg-open"; } String[] cmdArray = { viewer, filePath }; - Runtime.getRuntime().exec(cmdArray); + Process p; + p = Runtime.getRuntime().exec(cmdArray); + BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + line = in.readLine(); } @Override @@ -46,7 +50,11 @@ public void openFileWithApplication(String filePath, String application) throws String[] cmdArray = new String[openWith.length + 1]; System.arraycopy(openWith, 0, cmdArray, 0, openWith.length); cmdArray[cmdArray.length - 1] = filePath; - Runtime.getRuntime().exec(cmdArray); + Process p; + p = Runtime.getRuntime().exec(cmdArray); + BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + line = in.readLine(); } @Override