Proper fix for Java 10 complaining about illegal reflection access by jaxb-impl 2.3.0?

jaxb-ri runtime uses ClassLoader#defineClass / Unsafe#defineClass to do some bytecode modification in runtime to optimize performance. ClassLoader#defineClass is tried first which causes the warning. This legacy optimization is removed completely in jaxb-ri master (after 2.3.0, not released yet). To disable this optimization for 2.3.0, set system property com.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize. After next jaxb-ri release updating to newest … Read more

SimpleDateFormat with German Locale – Java 8 vs Java 10+

I don’t say it’s a nice solution, but it seems to be a way through. Map<Long, String> dayOfWeekTexts = Map.of(1L, “Mo”, 2L, “Di”, 3L, “Mi”, 4L, “Do”, 5L, “Fr”, 6L, “Sa”, 7L, “So”); Map<Long, String> monthTexts = Map.ofEntries(Map.entry(1L, “Jan”), Map.entry(2L, “Feb”), Map.entry(3L, “Mär”), Map.entry(4L, “Apr”), Map.entry(5L, “Mai”), Map.entry(6L, “Jun”), Map.entry(7L, “Jul”), Map.entry(8L, “Aug”), Map.entry(9L, “Sep”), … Read more

How to install JDK 10 under Ubuntu?

[*] Update: JDK 11 Now Available sudo apt-get install openjdk-11-jdk For JDK 10 Option 1: Easy Installation (PPA) sudo add-apt-repository ppa:linuxuprising/java sudo apt-get update sudo apt-get install oracle-java10-installer Then set as default with: sudo apt-get install oracle-java10-set-default And finally verify Installation with: $ java -version java version “10.0.1” 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build … Read more

Migrate Jersey project to use Java 10 results in java.lang.IllegalArgumentException at jersey.repackaged.org.objectweb.asm.ClassReader.

tl;dr To use Java 10, switch to Jersey 2.27 (which is the latest as of this date (10/5/18)). java.lang.IllegalArgumentException at jersey.repackaged.org.objectweb.asm.ClassReader.<init> Jersey repackages asm and puts these class files into the jersey-server jar. Just digging through the jar in my IDE, I looked at the ClassReader constructor (that’s what <init> means) to see where IllegalArgumentException … Read more

Eclipse can’t find XML related classes after switching build path to JDK 10

I assume that the project being migrated from Java 1.8 still has no module-info.java. This implies you are compiling code in the “unnamed module”. Code in the unnamed module “reads” all observable named and unnamed modules, in particular it reads module “java.xml” from the JRE System Library. This module exports package like java.xml.xpath. Additionally, you … Read more

Unable to compile simple Java 10 / Java 11 project with Maven

As of 30Jul, 2018 to fix the above issue, one can configure the java version used within maven to any up to JDK/11 and make use of the maven-compiler-plugin:3.8.0 to specify a release of either 9,10,11 without any explicit dependencies. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <release>11</release> <!–or <release>10</release>–> </configuration> </plugin> Note:- The default value for … Read more