404 questions
1293 votes
46 answers
1.6m views
How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
I have some code that uses JAXB API classes which have been provided as a part of the JDK in Java 6/7/8. When I run the same code with Java 9, at runtime I get errors indicating that JAXB classes can ...
181 votes
11 answers
371k views
Unable to compile simple Java 10 / Java 11 project with Maven
I have a trivial Maven project: src └── main └── java └── module-info.java pom.xml pom.xml: <groupId>org.example</groupId> <artifactId>example</artifactId> <...
792 votes
1 answer
76k views
Why does array[idx++]+="a" increase idx once in Java 8 but twice in Java 9 and 10?
For a challenge, a fellow code golfer wrote the following code: import java.util.*; public class Main { public static void main(String[] args) { int size = 3; String[] array = new String[...
85 votes
10 answers
87k views
Eclipse can't find XML related classes after switching build path to JDK 10
I'm developing on a Maven project (branch platform-bom_brussels-sr7) in Eclipse. When I recently tried switching the Java Build Path for the project to JDK 10, Eclipse build can no longer find ...
79 votes
12 answers
166k views
Maven: Invalid target release: 10
I'm trying to compile my maven project using Java 10 but I'm having trouble. In my IDE (IntelliJ IDEA) everything compiles and runs just fine under Java 10. I installed the latest maven version 3.5.4 ...
75 votes
7 answers
112k views
How to install JDK 10 under Ubuntu?
How do I install Java Development Kit (JDK) 10 on Ubuntu? The installation instructions on Oracle's help center only explain how to download and extract the archive on Linux platform, without any ...
79 votes
7 answers
10k views
Why can't the var keyword in Java be assigned a lambda expression?
It is allowed to assign var in Java 10 with a string like: var foo = "boo"; While it is not allowed to assign it with a lambda expression such as: var predicateVar = apple -> apple.getColor()....
34 votes
7 answers
20k views
JAXB not available on Tomcat 9 and Java 9/10
TLDR: On Java 9/10, a web app in Tomcat has no access to JAXB even though its reference implementation is present on the class path. Edit: No, this is not a duplicate of How to resolve java.lang....
29 votes
5 answers
81k views
Unrecognized VM option 'UseParNewGC' , Error: Could not create the Java Virtual Machine
I am trying to start a server using jre 10.0.1 64 bit. There is an obvious change in the settings for the JVM in windows start batch files. With the setting of -XX:+UseParNewGC as the reference point ...
51 votes
4 answers
12k views
SimpleDateFormat with German Locale - Java 8 vs Java 10+
I have code and a test-case in a legacy application, which can be summarized as follows: @Test public void testParseDate() throws ParseException { String toParse = "Mo Aug 18 11:25:26 MESZ +...
40 votes
4 answers
109k views
How to uninstall JDK on Mac OS?
Folks - I am facing challenges while trying to uninstall JDK from my MAC (macOS High Sierra Version 10.13.4 - 17E199). I have two JDK instances installed and I want to uninstall both of them. I am ...
52 votes
4 answers
51k views
Proper fix for Java 10 complaining about illegal reflection access by jaxb-impl 2.3.0?
We are looking at upgrading some legacy code to Java 10. As JAXB is not visible by default (EDIT: and the proper long term solution is not to circumvent the symptom using various JVM flags, but fix ...
22 votes
2 answers
58k views
The import java.awt cannot be resolved
I have installed the Eclipse [Version: Photon Release (4.8.0)] and JDK 10 on a MacBookPro with macOS 10.13.5 When I write in my code: import java.awt.*; I get the error: The import java.awt ...
28 votes
3 answers
20k views
How can IntelliJ show type hints for automatically inferred local variables in Java 10?
IntelliJ shows type hints for local variables in Kotlin as shown here: This makes it easy to see the type of variables even if their types are inferred. Java 10 introduces type inference for Java ...
-1 votes
2 answers
69 views
How to revert Java 10 "use local varaible type inference" via save actions?
I checked out the Java 10 option of "use local variable type inference" (JEP 286), but I think it is terrible to replace all type information with just the keyword var - was so much better ...