This is a short blog about the use of Oracle Java (JDK, JRE, etc) and license fees. As you may know, the use of the original Oracle Java on your machines comes with a fee you have to pay to Oracle, unless:
- You use an Oracle product that has a license covered for using Oracle Java, such as (but not limited to): Oracle Weblogic (Fusion MiddleWare), Oracle Enterprise Manager, etc. See Oracle Documentation and Website for more info if that is the case. Because not everything is covered. Check and double check.
- You use non-Oracle product that may cover a license for Java (from Oracle). For instance IBM DB2 has a IBM Java license which is based on Oracle Java, but also SAP can have Java licenses covered. Also Oracle Java on Red Hat Enterprise Linux installed systemwide for use for Red Hat Linux internal programs is permitted. Check the specific vendor on what is covered by their product for (Oracle) Java.
If you have come to the conclusion that the use of Oracle Java is not covered by some other license, you have to pay Oracle a fee. But it would be wise to investigate where you use Oracle Java, so you can decide if you really need it. If you don’t need it you can delete it, but if you do you can replace it by an OpenJDK Java instance.
This part is how to find those Oracle Java instances focussed mainly on Red Hat derivate linux, but may also work on other linux operating systems. There are several ways, the examples are on a Debian derivate Linux:
Check for a default java per linux user (maybe automated).
You can do this with using these commands:
# ask which Java is configured as default:
which java
For instance:
gahan@debianderivate:~$ which java
/usr/bin/java
When you got output of a java instance, while you’re at it also determine the version. Take the path and put -version behind it:
/usr/bin/java
For instance:
gahan@debianderivate:~$ /usr/bin/java -version
openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment (build 11.0.24+8-post-Ubuntu-1ubuntu322.04)
OpenJDK 64-Bit Server VM (build 11.0.24+8-post-Ubuntu-1ubuntu322.04, mixed mode, sharing)
gahan@minti7:~$
So here you are safe, a OpenJDK Java is used here. But when you see Oracle Java you have to do something about it (like said, our it’s covered under another products license, or you replace it by OpenJDK).
Check for Java installs on your linux system
The above doesn’t say everything and does not show if there are other Java’s installed. You have to be sure. So the best way is to use a user that has access to the whole linux filesystem, mostly this is root, but maybe if you can sudo with another user you can try and use that. With root:
#Login with root on the machine and do:
locate bin/java
For instance here you can see multiple Java’s. But in this case, when you dig deeper with ls, you can see that the Java is the same one, tied together with symlinks. But your case may vary, I’ve seen a lot of Red Hat derivate servers that have multiple Java’s all over the place:
gahan@debianderivate:~$ locate bin/java
/usr/bin/java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
gahan@debianderivate:~$ ls -al /usr/bin/java
lrwxrwxrwx 1 root root 22 apr 19 2023 /usr/bin/java -> /etc/alternatives/java
gahan@debianderivate:~$ ls -al /etc/alternatives/java
lrwxrwxrwx 1 root root 43 apr 19 2023 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
gahan@minti7:~$
How to know if your Java is actually used?
There are a few ‘easy’ ways to determine right away if the Java is used or not. This is not fail safe, even when the following doesn’t turn up anything, it still can be the case that is actually used even when it doesn’t show. Then further investigation is necessary.
Log in as root if there are processes using a Java instance:
#Log in with linux user, then do:
ps -ef |grep java
If something turns up, you can usually also see the path of the Java that is used and if you are lucky some clues which process or application uses Java.
You can also use something from java itself to determine if it is being used:
jps -v
If nothing turns up maybe your good. You can also turn it around if you want to be sure: check your applications running on your linux machine and check in configuration or documentation if Java is a dependency. Or you can maybe do something with logging calls to Java instances.
Happy Oracle Java hunting!