tl;dr Is it legal to redistribute tools.jar and JRE component of OpenJDK 8 with my app? If possible, tell me what OpenJDK vendor I can redistribute (RedHat, Azul,...) Installing JDK on user machine is NOT an answer here.

My application uses the Java Attach API, which needs tools.jar and JRE component of JDK (NOT the JRE from java.net, and because bundling attach.dll instead of the whole JRE component won't work (it will print out error Cannot find dependent libraries)). I want to include these components (tools.jar and JRE Component) in my app directory (not compiled inside the app), so that one only needs to install Java (normal JRE, from java.net) to run my app.

The problem is that I don't know if redistributing those without the whole OpenJDK package is legal. I did some search on the Internet, many sources said that one cannot redistribute OpenJDK without redistributing the whole bundle (https://stackoverflow.com/a/22477688/7908886). While some said that one can redistribute it as long as he/she comply with the GPL 2.0 with CLASSPATH EXCEPTION license of OpenJDK. (https://opensource.stackexchange.com/a/4583).

I'm really really confused here. If it is allowed to redistribute components of OpenJDK without the whole thing, please tell me how to do it step-by-step (and what OpenJDK vendor I can redistribute, such as: RedHat, Azul,...).

P/S: I have thought of notifying the user to install JDK before running the app, but I think JDK is for developer and kinda heavy (my customers will complain and they are not really good at computer stuffs, actually none of them will use JDK for any other purposes), so installing JDK is NOT an answer here.

  • 1
    Would jlink (introduced with Java 9) help here? I believe you may distribute the result. Aug 10, 2020 at 20:50

1 Answer 1


I do not know why the author of the SO answer writes as sie does. Having stated that you can't redistribute only parts of OpenJDK, sie then summarises the GPL as saying that you may "modify the program’s source code and distribute the modified source", which explicitly permits you to redistribute only parts of OpenJDK.

Yes, you may strip out of OpenJDK just the parts you need, and you may reuse them in your own code. You may do this with any code you receive under GPL: the question is what obligations will apply to you after you have done so.

Normally, if you were to use GPL code in this manner, then unless you could make the argument that your code only used the copied GPL code "at arm's length", you would be obliged to release all your code under GPL also. In this case, however, OpenJDK is covered by GPL plus the classpath exception. Our previous question on the subject considers what your obligations will be in this case, and they do not seem to include a requirement that your code, also, be published under GPL.

Follow Philippe's recommendations, and you should be OK to distribute, alongside your code, a modified OpenJDK containing only the elements that you need. We are not lawyers, though, so you should take professional legal advice before betting a company on this.

  • Thanks for your answer! There's only one thing that I don't know that is what obligations to comply. Is adding the GPL 2.0 with CLASSPATH EXCEPTION of OpenJDK for each file I bundled with my app enough? Aug 7, 2020 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.