Do I need to open my source code if I use OpenJDK as JVM?
Absolutely not.
There are many commercial, closed-source Java applications out there that use OpenJDK-based JVMs. The "Classpath exception" that @Chris Lercher mentions specifically makes this legal.
Incidentally, the "Classpath exception" was invented by FSF's lawyers specifically to allow the GNU Classpath libraries (a cleanroom reimplementation of the Java SE libraries) to be used to run proprietary / closed source applications. Hence, the name ...
The only cases where you would need to worry are things like:
- Closed source JVMs that use the OpenJDK codebase.
- Closed source applications that contain modified copies of OpenJDK classes without including source code for the modifications.
- Closed source applications that link to certain OpenJDK GPLv2 classes that are not marked as with the Classpath exception.
In OpenJDK 11, the last category seems to consist of a large number of "test" classes that are not included in an OpenJDK distro anyway, and internal classes that you shouldn't (and probably can't) link to in an application. These classes are easy to identify. Search for Java source files in the OpenJDK source tree that contain the word "GNU" and not the word "Classpath"
It is worth noting that a significant proportion of the OpenJDK Java code base is 3rd-party code with permissive open source licenses. Linking to those classes is permitted.
Bundling OpenJDK with closed-source is not a problem. The GPL permits you to distribute binaries for GPL software together with binaries for closed source software.