diff --git a/libbluray-java9.patch b/libbluray-java9.patch
new file mode 100644
index 0000000..d03ac27
--- /dev/null
+++ b/libbluray-java9.patch
@@ -0,0 +1,49 @@
+--- libbluray-1.0.1/src/libbluray/bdj/build.xml 2017-03-02 14:33:49.000000000 +0100
++++ libbluray-1.0.1/src/libbluray/bdj/build.xml 2017-10-30 08:32:10.295848485 +0100
+@@ -8,7 +8,6 @@
+
+
+
+-
+
+
+
+@@ -20,14 +19,12 @@
+
+
++ source="1.6" target="1.6">
+
+
+
+
++ source="1.6" target="1.6">
+
+
+
+--- libbluray-1.0.1/src/libbluray/bdj/java/java/io/BDFileSystem.java 2017-03-02 14:33:49.000000000 +0100
++++ libbluray-1.0.1/src/libbluray/bdj/java/java/io/BDFileSystem.java 2017-10-30 09:25:33.483391121 +0100
+@@ -38,7 +38,7 @@
+ import org.videolan.BDJXletContext;
+ import org.videolan.Logger;
+
+-public abstract class BDFileSystem extends FileSystem {
++public abstract class BDFileSystem extends UnixFileSystem {
+
+ private static final Logger logger = Logger.getLogger(BDFileSystem.class.getName());
+
+--- libbluray-1.0.1/src/libbluray/bdj/java-j2se/java/awt/peer/BDFramePeer.java 2017-03-02 14:33:49.000000000 +0100
++++ libbluray-1.0.1/src/libbluray/bdj/java-j2se/java/awt/peer/BDFramePeer.java 2017-10-30 09:08:08.259034704 +0100
+@@ -173,7 +173,7 @@
+ return ((BDToolkit)BDToolkit.getDefaultToolkit()).createImage((Component)null, width, height);
+ }
+
+- public boolean requestFocus(Component c, boolean a, boolean b, long l, sun.awt.CausedFocusEvent.Cause d) {
++ public boolean requestFocus(Component c, boolean a, boolean b, long l, FocusEvent.Cause d) {
+ if (c == null) {
+ return true;
+ }
diff --git a/libbluray.changes b/libbluray.changes
index b83f8f7..df3f268 100644
--- a/libbluray.changes
+++ b/libbluray.changes
@@ -1,3 +1,13 @@
+-------------------------------------------------------------------
+Mon Oct 30 08:54:50 UTC 2017 - fstrba@suse.com
+
+- Added patch:
+ * libbluray-java9.patch
+ + Fix build with jdk9
+ + Due to incompatible changes in jdk9, the same code cannot be
+ built with jdk9 and jdk <= 1.8
+ + Only apply on systems that hava jdk9
+
-------------------------------------------------------------------
Sun Sep 10 14:02:16 UTC 2017 - dimstar@opensuse.org
diff --git a/libbluray.spec b/libbluray.spec
index 6aac1cf..28d0937 100644
--- a/libbluray.spec
+++ b/libbluray.spec
@@ -27,6 +27,7 @@ Group: Productivity/Multimedia/Other
Url: http://www.videolan.org/developers/libbluray.html
Source0: http://download.videolan.org/pub/videolan/%{name}/%{version}/%{name}-%{version}.tar.bz2
Source99: baselibs.conf
+Patch1: libbluray-java9.patch
Patch2: libbluray-jvm_dir.patch
BuildRequires: ant
BuildRequires: java-devel >= 1.6
@@ -35,7 +36,6 @@ BuildRequires: pkgconfig
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(libxml-2.0) >= 2.6
-BuildConflicts: java-devel >= 1.9
%description
This library is written for the purpose of playing Blu-ray movies. It is
@@ -73,7 +73,11 @@ MPlayer). We, the authors of this library, do not condone nor endorse piracy.
%package bdj
Summary: Library to access Blu-Ray disk - BD-J support
Group: Development/Libraries/Java
+%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
+Requires: java >= 9
+%else
Requires: java >= 1.6
+%endif
Requires: jpackage-utils
%if 0%{?suse_version} > 1110
BuildArch: noarch
@@ -86,6 +90,9 @@ MPlayer). We, the authors of this library, do not condone nor endorse piracy.
%prep
%setup -q
+%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
+%patch1 -p1
+%endif
%patch2
%build