Eclipse – Changing Targeted JRE

Background

Playing around with Hibernate in Eclipse.

Discovered that the platforms supported are 1.8 and 11.

Wanted to switch between the two.

Hibernate

Compatibility Matrix

BTW, Hibernate’s Compatibility Matrix is available here :-

compatibilityMatrix.01.20190506.1250AM.PNG

 

How to do so

Outline

  1. Load Project
  2. Accessed the menu option Project/Property
  3. In the Property window, accessed the “Java Build Path” tab
  4. Access the Libraries Tab
    • Please choose the JRE System Library entry
    • Click the Edit option
  5. In the “JRE System Library” window
    • Execution Environment
      • Please review the “Execution environment” drop-down
        • In our case we chose JavaSE-11 ( jdk-11.0.3 )
  6. Build
    • Clean
      • Please access the Clean Window to cleanly build the project
      • This ensures that the project is cleanly built

Images

Image – Current

Image – Current – Java Build Path – Libraries

The current class path is JavaSE-1.8 ( jre1.8.0_181 )

properties.JavaBuildPath.JRE.1.8-01.20190506.0719PM.PNG

Image – Current – JRE System Library – JavaSE-1.8 ( jre 1.8.0_181 )

The current JavaSE-1.8 ( jre1.8.0_181 )

properties.JavaBuildPath.editLibrary.JRE.1.8-01.20190506.0717PM.PNG

Image – Current – JRE System Library

The Execution environment is JavaSE-1.8 ( jre1.8.0_181 )

properties.JavaBuildPath.editLibrary.JRE.1.8-01.20190506.0717PM.PNG

Image – Revised – JRE System Library – JavaSE-11 ( jre 11 )

Here we chose :-

  1. System Library
    • Execution Environment
      • JavaSE-11 ( jdk-11.0.3 )

 

JRESystemLibrary.ExecutionEnvironment.jdk-11.0.3.20190506.0402AM

Image – Build – Clean

Cleanly build project

project.build.clean.20190507.0310AM

Metadata

Outline

  1. Java’s Class Targeted JDK Version
    • javap

Java’s Class targeted JDK Version

javap

Syntax


javap -verbose [java-class-file] | findstr "major" 

Sample


"C:\Program Files\Java\jdk-11.0.3\bin\javap" -verbose bin\org\learningintheopen\sample\HelloWorld.class | findstr "major"

Output

Output – Major Version – 52

When built again JDK 1.8, we get major version of 52

java.1.8.20190507.0335AM

Output – Major Version – 55

When built again JDK 11, we get major version of 55

java.11.20190507.0336AM

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s