I moved this question to this place here as I got the information on stackoverflow - the question is offtopic there. Here is my original question at SO (and the discussion): https://stackoverflow.com/questions/61152045/which-jre-may-be-distributed-with-my-libgdx-game

I am in the setup process of the final binary distribution of my libgdx game.

Most people use packr (https://github.com/libgdx/packr) to create a windows exe for the jar file of the game, so do I. Spiced up with rcedit (https://github.com/electron/rcedit) which allows me to set the icon and copyright/version strings in the exe after packr has run, I am now a bit unsure whether I did everything right.

The game is written in Android Studio as it runs on Desktop and Android.

packr uses the jre from Android Studio which is by default installed at C:\Program Files\Android\Android Studio\jre

My question is: if packr uses this jre to create the jre folder that is packed with my game... is this allowed? I have no other jdk/jre/whatever installed on my system as the one from Android Studio is all I ever needed to develop my apps.

As far as I can see, packr included all the important files and license files. But may I distribute my game when the created jre from packr is based on the jre of Android Studio?

I tried to create a jre from openJdk following these steps: https://stackoverflow.com/questions/51403071/create-jre-from-openjdk-windows

The effect was that the jre was over 200MB in size (compared to android studio's ~65MB jre) and the game needed almost 7 times longer to start up with openJDK. While I had the spash screen within ~3 seconds in android studio's jre, openJDK needed over 20 seconds to show the same splash screen. Both issues I want to avoid, so I'd prefer simply re-packing from android studio's jre.

So... is this legally ok?

I am not native english, what doesn't make all that easier for me...

jre Folder structure

After running jlink and packr, I have these folders in jre:

and a files named "release"


the legal folder contains 73(!) subfolders, each of them containing on or more of these files



The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
only ("GPL2"), with the following clarification and special exception.

    Linking this OpenJDK Code statically or dynamically with other code
    is making a combined work based on this library.  Thus, the terms
    and conditions of GPL2 cover the whole combination.

    As a special exception, Oracle gives you permission to link this
    OpenJDK Code with certain code licensed by Oracle as indicated at
    ("Designated Exception Modules") to produce an executable,
    regardless of the license terms of the Designated Exception Modules,
    and to copy and distribute the resulting executable under GPL2,
    provided that the Designated Exception Modules continue to be
    governed by the licenses under which they were offered by Oracle.

As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
to build an executable that includes those portions of necessary code that
Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
with the Classpath exception).  If you modify or add to the OpenJDK code,
that new GPL2 code may still be combined with Designated Exception Modules
if the new code is made subject to this exception by its copyright holder.


This file is pretty long as far as I can say, it contains a complete GNU License

it starts with:
The GNU General Public License (GPL)

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.



Certain files distributed by Oracle America, Inc. and/or its affiliates are 
subject to the following clarification and special exception to the GPLv2, 
based on the GNU Project exception for its Classpath libraries, known as the 
GNU Classpath Exception.

Note that Oracle includes multiple, independent programs in this software 
package.  Some of those programs are provided under licenses deemed 
incompatible with the GPLv2 by the Free Software Foundation and others. 
For example, the package includes programs licensed under the Apache 
License, Version 2.0 and may include FreeType. Such programs are licensed 
to you under their original licenses. 

Oracle facilitates your further distribution of this package by adding the 
Classpath Exception to the necessary parts of its GPLv2 code, which permits 
you to use that code in combination with other independent modules not 
licensed under the GPLv2. However, note that this would not permit you to 
commingle code under an incompatible license with Oracle's GPLv2 licensed 
code by, for example, cutting and pasting such code into a file also 
containing Oracle's GPLv2 licensed code and then distributing the result. 

Additionally, if you were to remove the Classpath Exception from any of the 
files to which it applies and distribute the result, you would likely be 
required to license some or all of the other code in that distribution under 
the GPLv2 as well, and since the GPLv2 is incompatible with the license terms 
of some items included in the distribution by Oracle, removing the Classpath 
Exception could therefore effectively compromise your ability to further 
distribute the package. 

Failing to distribute notices associated with some files may also create 
unexpected legal consequences.
Proceed with caution and we recommend that you obtain the advice of a lawyer 
skilled in open source matters before removing the Classpath Exception or 
making modifications to this package which may subsequently be redistributed 
and/or involve the use of third party software.

After reading all that and with a look at openJdk's website, the confusion increases as I found there something about CLASSPATH_EXCEPTION but I couldn't find that in the license files.

Taken from https://jdk.java.net/14/

JDK 14 General-Availability Release
This page provides production-ready open-source builds of the Java Development Kit, version 14, an implementation of the Java SE 14 Platform under the GNU General Public License, version 2, with the Classpath Exception.

When I follow the link to the classpath_exception, I land on this page: https://openjdk.java.net/legal/gplv2+ce.html

So what is the one single truth now?

Thanks in advance, Gris

  • Which Java/JRE version are you using and which brand (Oracle,OpenJDK/something else)? What do the JRE license files (that were included by packr) say? Apr 11 '20 at 7:30
  • Currently I have both configurations (android studio and openJdk). From what I found through google, openjdk might be the way to go, but there are so many license files and assembly_exception here and classpath_exception there - it's dozens of license files one in each folder and many link to other files, some identical... it's the pure nightmare of wall-of-text. why must that be so complicated. i can not attach all that files here. i try to find a subset and attach it to the question - I am not native english, which doesn't make it easier for me.
    – Grisgram
    Apr 12 '20 at 3:36
  • Is the license information you added (thanks for that) from the Android Studio jre or the OpenJDK one? I am interested in the Android Studio jre. Apr 12 '20 at 14:43
  • The Android Studio jre has a very different folder structure, the license files I found are: the same ASSEMBLY_EXCEPTION, the same GNU GPLv2 (with no hint to classpath_exception - same as in openJdk) but it does NOT contain the ADDITIONAL_LICENSE_INFO file. It contains a THIRD_PARTY_README file of ~150kB containing tons of third party licenses. that's all. So long story short: 2 identical files, both no hint to classpath_exception and android studio jre is short of the additional file.
    – Grisgram
    Apr 12 '20 at 16:30

TL/DR: Yes, it is allowed to distribute the Android Studio JRE that you have along with your game in the way that packr did.

Both the OpenJDK and the Andoid Studio JRE that you use appear to be licensed under the GPLv2 license with the Classpath exception1.

The GPL version 2 is an open source license that allows redistribution of the covered code under the same license terms. The GPL is also a copyleft license that requires that if GPL code gets used (even as a library) in a larger program, then that entire program must be distributed under the terms of the GPL license. The Classpath exception weakens that requirement a bit by allowing the code with that exception to be used by non-GPL applications as long as it is only included as a library that gets loaded through Java's Classpath.

Combined, this means that you can write Java programs with any license you like (even closed-source licenses) as long as you use the normal classpath based mechanisms to refer to the classes in the JRE. And the JRE itself has a license that allows you to redistribute it.

1 You mentioned you didn't find any reference to the classpath exception in the Android Studio JRE. I expect it to be there but just not referenced by that name.

  • Thank you very much for investing time to walk through that! I keep this question in my bookmarks as I know some other libGdx/Java developers and they might end up with the same font-size-96-double-bold-question-marks above their heads when it comes to distribution.
    – Grisgram
    Apr 13 '20 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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