No need to rewrite anything. There is an excellent summary here: https://medium.com/@javachampions/java-is-still-free-2-0-0-6...
the tl;dr is that there are multiple OpenJDK vendors now, Oracle just happens to charge for their JDK distribution, but you can choose from several vendors (Azul, Red Hat, IBM, AdoptOpenJDK, Amazon Correto, etc)