diff --git a/swing-worker-1.2-encoding.patch b/swing-worker-1.2-encoding.patch
new file mode 100644
index 0000000..a5ae620
--- /dev/null
+++ b/swing-worker-1.2-encoding.patch
@@ -0,0 +1,34 @@
+--- swing-worker-1.2/src/java/org/jdesktop/swingworker/AccumulativeRunnable.java	2017-09-19 12:45:11.236777157 +0200
++++ swing-worker-1.2/src/java/org/jdesktop/swingworker/AccumulativeRunnable.java	2017-09-19 12:45:52.264777858 +0200
+@@ -1,7 +1,7 @@
+ /* 
+  * $Id: AccumulativeRunnable.java,v 1.3 2008/07/25 19:32:29 idk Exp $
+  * 
+- * Copyright � 2005 Sun Microsystems, Inc. All rights
++ * Copyright (c) 2005 Sun Microsystems, Inc. All rights
+  * reserved. Use is subject to license terms.
+  */
+ 
+--- swing-worker-1.2/src/java/org/jdesktop/swingworker/SwingPropertyChangeSupport.java	2017-09-19 12:45:11.236777157 +0200
++++ swing-worker-1.2/src/java/org/jdesktop/swingworker/SwingPropertyChangeSupport.java	2017-09-19 12:46:44.532778750 +0200
+@@ -1,7 +1,7 @@
+ /* 
+  * $Id: SwingPropertyChangeSupport.java,v 1.1 2005/06/18 21:27:14 idk Exp $
+  * 
+- * Copyright � 2005 Sun Microsystems, Inc. All rights
++ * Copyright (c) 2005 Sun Microsystems, Inc. All rights
+  * reserved. Use is subject to license terms.
+  */
+ 
+--- swing-worker-1.2/src/java/org/jdesktop/swingworker/SwingWorker.java	2017-09-19 12:45:11.236777157 +0200
++++ swing-worker-1.2/src/java/org/jdesktop/swingworker/SwingWorker.java	2017-09-19 12:45:52.268777858 +0200
+@@ -1,7 +1,7 @@
+ /* 
+  * $Id: SwingWorker.java,v 1.6 2008/07/25 19:32:29 idk Exp $
+  * 
+- * Copyright � 2005 Sun Microsystems, Inc. All rights
++ * Copyright (c) 2005 Sun Microsystems, Inc. All rights
+  * reserved. Use is subject to license terms.
+  */
+ 
+Binary file (standard input) matches
diff --git a/swing-worker-1.2-nosource.patch b/swing-worker-1.2-nosource.patch
new file mode 100644
index 0000000..1c0ed5a
--- /dev/null
+++ b/swing-worker-1.2-nosource.patch
@@ -0,0 +1,27 @@
+--- swing-worker-1.2/build.xml	2017-09-19 12:32:24.933623439 +0200
++++ swing-worker-1.2/build.xml	2017-09-19 12:33:17.409624335 +0200
+@@ -33,13 +33,13 @@
+     </target>
+     
+     <target name="compile" depends="init">
+-        <javac source="1.5" destdir="${build.dir}" memoryMaximumSize="200m" fork="yes">
++        <javac destdir="${build.dir}" memoryMaximumSize="200m" fork="yes">
+             <src path="${src.dir}" />
+         </javac>
+     </target>
+ 
+     <target name="demo" depends="compile">
+-        <javac source="1.5" destdir="${build.dir}" memoryMaximumSize="200m" fork="yes">
++        <javac destdir="${build.dir}" memoryMaximumSize="200m" fork="yes">
+             <src path="${demo.dir}" />
+         </javac>
+         <java classpath="${build.dir}" 
+@@ -47,7 +47,7 @@
+     </target>
+     
+     <target name="test" depends="compile">
+-        <javac source="1.5" destdir="${build.dir}" memoryMaximumSize="200m" fork="yes">
++        <javac destdir="${build.dir}" memoryMaximumSize="200m" fork="yes">
+             <src path="${test.dir}" />
+          </javac>
+          <junit printsummary="yes" showoutput="yes" fork="yes">
diff --git a/swing-worker.changes b/swing-worker.changes
index 353caaf..3e4e3fe 100644
--- a/swing-worker.changes
+++ b/swing-worker.changes
@@ -1,3 +1,16 @@
+-------------------------------------------------------------------
+Tue Sep 19 10:53:19 UTC 2017 - fstrba@suse.com
+
+- Fix build with jdk9: specify java source and target 1.6
+- Added patches:
+  * swing-worker-1.2-nosource.patch
+    + Don't hardcode the source and target levels in the build.xml
+    + We are specifying them on command-line
+  * swing-worker-1.2-encoding.patch
+    + Patch out the offending characters instead of specifying the
+      encoding, since there are different encodings in different
+      files.
+
 -------------------------------------------------------------------
 Fri Jul 11 14:10:03 UTC 2014 - tchvatal@suse.com
 
diff --git a/swing-worker.spec b/swing-worker.spec
index b8184f6..f5cda6b 100644
--- a/swing-worker.spec
+++ b/swing-worker.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package swing-worker
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -25,10 +25,12 @@ Group:          Development/Libraries/Java
 Url:            https://swingworker.dev.java.net/
 Source0:        %{name}-src-%{version}.tar.bz2
 Source1:        releasenotes.txt
+Patch0:         swing-worker-1.2-nosource.patch
+Patch1:         swing-worker-1.2-encoding.patch
 BuildRequires:  ant
+BuildRequires:  fdupes
 BuildRequires:  java-devel
-Requires:       jre >= 1.5
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+Requires:       java
 BuildArch:      noarch
 
 %description
@@ -60,6 +62,8 @@ SwingWorker included into Java 1.6.
 
 %prep
 %setup -q -c %{name}-%{version}
+%patch0 -p1
+%patch1 -p1
 # remove all third party jars
 find . -iname '*.jar' | xargs rm -rf
 cp %{SOURCE1} .
@@ -68,7 +72,7 @@ sed -i -e 's/.$//' releasenotes.txt COPYING
 
 %build
 ant \
-    -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 \
+    -Dant.build.javac.source=1.6 -Dant.build.javac.target=1.6 \
     bundles
 
 %install
@@ -79,21 +83,20 @@ install -pm 644 dist/bundles/%{name}.jar %{buildroot}/%{_javadir}/%{name}-%{vers
 # javadoc
 install -d -m 755 %{buildroot}/%{_javadocdir}/%{name}
 cp -pr dist/javadoc/* %{buildroot}/%{_javadocdir}/%{name}
+%fdupes -s %{buildroot}/%{_javadocdir}/%{name}
 # demo
 install -d %{buildroot}/%{_datadir}/%{name}
-cp -pr src/demo  %{buildroot}/%{_datadir}/%{name}
+cp -pr src/demo %{buildroot}/%{_datadir}/%{name}
+%fdupes -s %{buildroot}/%{_datadir}/%{name}
 
 %files
-%defattr(0644,root,root,0755)
 %doc COPYING releasenotes.txt
 %{_javadir}/*.jar
 
 %files javadoc
-%defattr(0644,root,root,0755)
 %{_javadocdir}/%{name}
 
 %files demo
-%defattr(0644,root,root,0755)
 %{_datadir}/%{name}
 
 %changelog