Skip to content

Commit 98edbfb

Browse files
committed
Fix opening pdf with okular in linux (JabRef#5253)
1 parent 6319d05 commit 98edbfb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
1515

1616
### Fixed
1717

18+
- 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)
1819
- 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)
1920
- 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)
2021
- We fixed an issue where non-default previews didn't handle unicode characters. [#5779](https://github.com/JabRef/jabref/issues/5779)

src/main/java/org/jabref/gui/desktop/os/Linux.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public void openFile(String filePath, String fileType) throws IOException {
3030
viewer = "xdg-open";
3131
}
3232
String[] cmdArray = { viewer, filePath };
33-
Runtime.getRuntime().exec(cmdArray);
33+
Process p;
34+
p = Runtime.getRuntime().exec(cmdArray);
35+
BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream()));
36+
String line;
37+
line = in.readLine();
3438
}
3539

3640
@Override
@@ -46,7 +50,11 @@ public void openFileWithApplication(String filePath, String application) throws
4650
String[] cmdArray = new String[openWith.length + 1];
4751
System.arraycopy(openWith, 0, cmdArray, 0, openWith.length);
4852
cmdArray[cmdArray.length - 1] = filePath;
49-
Runtime.getRuntime().exec(cmdArray);
53+
Process p;
54+
p = Runtime.getRuntime().exec(cmdArray);
55+
BufferedReader in = new BufferedReader(new InputStreamReader(p.getErrorStream()));
56+
String line;
57+
line = in.readLine();
5058
}
5159

5260
@Override

0 commit comments

Comments
 (0)