There are two parts.
The JDK which is open source, and according to the JDK license is free to use :
A. Software Internal Use and Development License Grant. Subject to
the terms and conditions of this Agreement and restrictions and
exceptions set forth in the Software "README" file incorporated herein
by reference, including, but not limited to the Java Technology
Restrictions of these Supplemental Terms, Oracle grants you a
non-exclusive, non-transferable, limited license without fees to
reproduce internally and use internally the Software complete and
unmodified for the purpose of designing, developing, and testing your
Programs.
And the JRE part which can run such applications :
- LICENSE TO USE. Subject to the terms and conditions of this
Agreement, including, but not limited to the Java Technology
Restrictions of the Supplemental License Terms, Oracle grants you a
non-exclusive, non-transferable, limited license without license fees
to reproduce and use internally Software complete and unmodified for
the sole purpose of running Programs. Additional licenses for
developers and/or publishers are granted in the Supplemental License
Terms.
Between the two steps there is only one license, the one you put on your application.
You can develop your application without fees. And users can use your application without fees.
Ergo, you can use your own application without fees.
Resources :