15

Where to get tools.jar for Java 8 JDK early release? Without it, my Java 1.8 Maven pom based projects in Netbeans will not compile.

The Java 8 early release is set in the Java Platforms setting and all the Java 8 projects that are not Maven-based will compile and run.

https://jdk8.java.net/download.html

It is not found on the downloads page, I can not find anything in their search.

Does anyone have success compiling Maven pom based projects with the Java 8 early release?

Can the old tools.jar be used or where did you find it?

Dharman
  • 30,962
  • 25
  • 85
  • 135
The Coordinator
  • 13,007
  • 11
  • 44
  • 73
  • 1
    It's in the JDK. You didn't accidentally download the JRE did you? There are several questions in a similar vein on this site that mention the same issue – Anya Shenanigans Nov 01 '13 at 08:19
  • 1
    @Petesh I had the JDK from early in October (JDK, not JRE) and I verified it is not there. I just reinstalled the JDK from the most recent version and it is there. – The Coordinator Nov 01 '13 at 08:57
  • I rolled back your edit. You are not allowed to add answers in the body of the question. If you found an alternative solution then please add it in the space below where all the other answers go. – Dharman Dec 31 '20 at 18:37
  • 2
    The age of the question has nothing to do with it. You should not have put it there in the first place. If this is a clarification of the problem then you should remove the big ANSWER part. It is confusing. However, it doesn't look as a clarification, it looks like a solution in which case it invalidates the question and should be removed. If you want to keep it then add it as an answer below. That's how Q&A sites work. – Dharman Dec 31 '20 at 18:52

13 Answers13

18

The tools.jar file on the 1.8.0 JDK is located in jdk1.8.0/lib/tools.jar. If it's not there, then you don't have the JDK installed correctly.

Please see the accepted answer - the tools.jar file was omitted in a specific early access revision (jdk-8-ea-bin-b106-windows-i586-05_sep_2013.exe).

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
  • 2
    In my jdk1.8.0_102 it's not there any more. – Martin Stein Oct 04 '16 at 19:04
  • 1
    Details are important when you make mention of 'it not being there any more' - what platform, exactly what version, how did you install it, etc… I'm looking at the i686 version of java installed on windows and it has tools.jar in `c:/program files (x86)/Java/jdk1.8.0_102/lib/tools.jar` – Anya Shenanigans Oct 05 '16 at 07:31
  • See 'Answer on the behalf of OP' below. Basically, Oracle didn't bundle it in certain versions - seemingly by accident. – The Coordinator Jan 04 '21 at 21:26
8

You just need to install devel package. On RHEL family it's like this:

# yum install java-1.8.0-openjdk-devel
mironq
  • 346
  • 1
  • 3
  • 9
6

I had a similar problem when using Hadoop-Common-2.7.2 as a dependency. I resolved the problem by adding the following exclusions to my POM.xml file:

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.7.2</version>
    <exclusions>
        <exclusion>
            <groupId>jdk.tools</groupId>
            <artifactId>jdk.tools</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Praveen Kumar K S
  • 3,024
  • 1
  • 24
  • 31
  • Thanks this worked perfectly. But for future reference, if tools.jar is needed, where do I get it from? It is not in my java\jdk-14.0.1\lib or bin folders. – Shervin Rad Aug 02 '20 at 19:13
  • It should be in that folder, if it's not you might have installed wrong version or corrupted version. In windows it will be in c:/Prog~File@~/java/JDK ~/lib folder. – Praveen Kumar K S Dec 21 '20 at 03:32
2

You can download any version of the tools.jar file. For example, it is available from java2s.com. It would be preferable, though, to find it on the official Oracle site, if possible.

After downloading any version of the tools-x.x.jar file, simply rename it to tools.jar (removing the version number) and place it in the jrex.x/lib folder.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
itzy
  • 21
  • 1
2

Some JDK packages contain just the Java Runtime Environment.

So for instance in Fedora, Oracle Linux, RHEL, CentOS java-1.8.0-openjdk package contains just the JRE. If you want the development tools, then install the java-1.8.0-openjdk-devel package instead.

And in Debian/Ubuntu openjdk-8-jre package contains just the JRE. If you want the development tools, then install the openjdk-8-jdk package instead.

Gayan Weerakutti
  • 11,904
  • 2
  • 71
  • 68
2

The file tools.jar was removed in Java 9. Please see "Removed Tools and Components" on Oracle.com JDK 9 page here

The Coordinator
  • 13,007
  • 11
  • 44
  • 73
psd
  • 31
  • 1
1

I had a similar problem and found the solution in the Android Public Issue Tracker: tools.jar not packed in lib of Java JDK 8 and Android studio gives tools.jar missing error.

As kn...@gmail.com states in comment #8, the error appears only when the JDK is not installed in its default directory. The problem is resolved by reinstalling the JDK into its default directory.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Etic
  • 291
  • 4
  • 9
1

Make sure you look into the folder C:/Program Files/Java/jdk1.8.0_version/lib instead of C:/Program Files (x86)/Java/jdk1.8.0_version/lib

Leonardo Alves Machado
  • 2,747
  • 10
  • 38
  • 53
Sami
  • 295
  • 2
  • 6
  • 10
1

Answer on the behalf of question author:

This version is missing tools.jar: jdk-8-ea-bin-b106-windows-i586-05_sep_2013.exe

It is now in the most recent release.

  • 6
    This q/a is being discussed in the [meta](https://meta.stackoverflow.com/questions/404191/are-m) – TheMaster Jan 02 '21 at 12:33
  • I purposely put the answer in the original question because Oracle accidentally omitted `tools.jar` from the exe install file for *only/just that version*. This is very unexpected! I would not expect others to read this page and digest all the various answers to find out why it is missing. The most immediate thing tome was to present the unexpected answer. That is why. I only wanted to save people from digesting this entire page to fix this bug. Of course, there is nothing wrong with other answers. However, I wanted to curate the primary issue, i.e., *Oracle forgot to bundle it in the exe.* – The Coordinator Jan 04 '21 at 21:19
  • I would suggest that if the issue only appears in a specific release, then either 1. information about the specific release should appear in the question (which it may be; I don't think I am familiar enough with Java to definitely exclude the possibility), or 2. the answer should be better phrased as something like "If you are using version `X`, version `X` was missing `tools.jar`. This has been fixed in later versions / from version `Y`. I think 2 is the better option here, so as not to invalidate all the other answers. – Zev Spitz Jan 05 '21 at 06:34
0

When I looked at Eclipse > Window > preference > Java > Installed JRE >, it was pointing to JRE, which seems obvious. However, when I changed it to point to JDK, the compile error was resolved. This is because there is tools.jar in the JDK folder.

Before this, I had tried copying tools.jar from jdk/lib to jre/lib. However, that did not solve the issue.

The Coordinator
  • 13,007
  • 11
  • 44
  • 73
Akshay Vijay Jain
  • 13,461
  • 8
  • 60
  • 73
  • I tried changing JRE to JDK, I do have tools.jar in jdk. C:\Program Files\Java\jdk1.8.0_221. But it does not work - eclipse somehow keeps pointing to the JRE folder. **I applied and restarted eclipse.** – Sam-T Feb 06 '20 at 21:35
  • My JAVA_HOME also point to jdk (since begining). Eclipse keeps giving this tools.jar error. Added the STS plugin but Spring does not show up in the New project list. I guess it is related to this tools.jar. The jre list in eclipse itself points to the jdk folder, does not show tools.jar in the list. – Sam-T Feb 07 '20 at 00:06
0

Simply copy the tools.jar from your jdk\lib folder and paste into jre\lib folder.

The Coordinator
  • 13,007
  • 11
  • 44
  • 73
Fahad
  • 56
  • 6
0

The solution is to update the eclipse.ini file. If no JDK is used for Eclipse, change it:

  • Quit Eclipse if it is running
  • Go to the Eclipse installation directory and open the file eclipse.ini in a text editor
  • Search for the line -vmargs
  • Before the line -vmargs, add two lines:
    • On the first line, write -vm
    • On the second line, write the path to your JDK installation (usually something like: C:\Program Files\Java\jdk1.6.0_31\bin\javaw.exe on Windows)*

Solution also documented here

The Coordinator
  • 13,007
  • 11
  • 44
  • 73
Sam-T
  • 1,877
  • 6
  • 23
  • 51
0

If using Reactive Native:

  1. Install the latest JDK from here.

  2. If the problem not solved then go back to react-native documentation about installing react native (android) on mac, here

  3. In root of your reactnative project:

    cd android
    ./gradlew clean 
    ./gradlew assembleRelease
    
The Coordinator
  • 13,007
  • 11
  • 44
  • 73