Madala
Madala

Reputation: 41

Unable to locate tools.jar for Java SE 14

tools.jar is not present in latest Java version 14. Can anyone help me to understand whether it is replaced or where it is?

My system is having:

C:\Users\Admin>wmic os get osarchitecture
OSArchitecture
64-bit

I have installed latest Java version by downloading jdk-14.0.2_windows-x64_bin.exe from Oracle's website.

After Installation, I looked in installation folder C:\Program Files\Java\jdk-14.0.2\lib and it is not having tools.jar.

Do we need to install any other packages for JRE that would help with tools.jar?

If tools.jar is not present, what is the replacement?

Upvotes: 4

Views: 4663

Answers (3)

Tuhin Mitra
Tuhin Mitra

Reputation: 727

I had the same problem just few minutes back.

I downloaded openjdk-11-jdk-headless by typing the following command from Ubuntu terminal:

$ sudo apt install openjdk-11-jdk-headless

Then, open the project structure inside intellij idea. shortcut: (Ctrl+Alt+Shift+S).

You can see my screenshot for a visual guide.

There select the jdk version (openjdk 11 here) and change the language Project Language Level to 11

enter image description here

Upvotes: 1

Stephen C
Stephen C

Reputation: 718658

Do we need to install any other packages for JRE that would help with tools.jar?

No. There is no simple workaround.

If tools.jar is not present, what is the replacement?

There isn't a direct replacement. Instead you must change the application so that it doesn't depend on the existence of the file.

Java 9+ uses the Java Platform Module System rather than tools.jar, rt.jar and so one. See the other Answer on this page, by Giorgi Tsiklauri.

  • If the dependency is in your own code, change the code so that it access the Java compilers, etc via the Tools API. If your code is checking for the existence of tools.jar, remove the check and (if necessary) check a different way.

  • If the dependency is in third-party code (probably a tool) you need to upgrade it to a version that is compatible with the version of Java that you are trying to use.

Upvotes: 4

Giorgi Tsiklauri
Giorgi Tsiklauri

Reputation: 11110

Removed as of Java 9

Effective since Java 9, JEP 220: Modular Run-Time Images removed rt.jar, tools.jar, dt.jar and some other jar files.

To quote from the JEP:

Removed: rt.jar and tools.jar

The class and resource files previously stored in lib/rt.jar, lib/tools.jar, lib/dt.jar, and various other internal JAR files are now stored in a more efficient format in implementation-specific files in the lib directory. The format of these files is not specified and is subject to change without notice.

Upvotes: 3

Related Questions