Lesson 2 - Activity 1 - Why are we getting warnings about source value 1.5?

Lesson 2 - Activity 1 - Why are we getting warnings about source value 1.5?

Time: 10 minutes

Purpose: This activity helps you get familiar with using Googe to search for answers on Java

Introduction: During compiling of our code, we recieved the following warning about 1.5 being obsolete, and I said we’d ignore it for now.

Task: Google the error message, and find out explanations for why this is not a major issue. Satisfy your own curiosity around this and post your description below.

1 Like

Warning:java: source value 1.5 is obsolete and will be removed in a future release

The reason is due to Maven - a maven project by default uses Java 1.5 compiler. You need to override it to Java 1.8 in the pom.xml file. By definition maven is combination of plugins, so we need to add the compiler plugin and specify the Java compiler version. (source: https://blog.softhints.com/java-8-warning-java-target-source-value-1-5-is-obsolete/).

IDEA uses compiler ( a tool) of version 1.8, but name resolution, linking and bytecode generation are done against java 5 libraries from your project’s classpath by means of javac’s cross-compilation capabilities. Not only java 5 is supported as a target platform, but all java versions, including java 1.
(source: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206805405-Idea-15-javac-compiler)

2 Likes

Yup - you can make some modifications to make this warning go away. I wanted to avoid doing that on your first lesson. Even though it means ‘ignoring warnings’ which can be a bad practice.

But this one, it’s okay.

I know I was supposed to look up the warning specified, but I had an error when building:
Error:java: error: release version 5 not supported

Looked it up and I had to change settings to Maven and the Java compiler. Found the fix on stack overflow. I found it very satisfying to look that up, find a possible fix, and apply it!

When that was fixed I had a new error: Error:(4, 15) java: package system does not exist. Turns out it was because I did not capitalize ‘System’ in the System.out.println…whoops!

That is really good work Valarie!

A good part of the exercise is getting you used to looking up for answers on the internet. You’d be surprised just how many professional developers do just this. It’s an important skillset to grow.

Hi Mike,

I see there are plenty of solutions available to get rid of this warning, and although I’m compiling “Hello World” without getting the warning, your comments about there being solutions only a Google away are more than justified!

Cheers!

Ralph