Short Version
In NetBeans under Project Properties → Sources → Source Binary Format, there is supposed to be an option to select a Java Profile:
But for me it's missing:
What's doing?
Long Version
Java has the option to run four modes:
- Compact 1
- Compact 2
- Compact 3
- Full JRE
The default has always been a "Full JRE" - there was nothing else. But they wanted to define more compact versions of the runtime. If you advertise you are willing to run with a more stripped-down version of the Java Runtime, it can give you faster application startup with, with less disk and memory usage.
It just comes at the cost of being able to use less of the JRE:
Full JRE | Compact1 | Compact2 | Compact3 | Full JRE |
---|---|---|---|---|
java.lang | ✔️ | ✔️ | ✔️ | ✔️ |
java.io | ✔️ | ✔️ | ✔️ | ✔️ |
java.nio | ✔️ | ✔️ | ✔️ | ✔️ |
java.text | ✔️ | ✔️ | ✔️ | ✔️ |
java.math | ✔️ | ✔️ | ✔️ | ✔️ |
java.net | ✔️ | ✔️ | ✔️ | ✔️ |
javax.net | ✔️ | ✔️ | ✔️ | ✔️ |
java.util | ✔️ | ✔️ | ✔️ | ✔️ |
java.util.logging | ✔️ | ✔️ | ✔️ | ✔️ |
java.security | ✔️ | ✔️ | ✔️ | ✔️ |
javax.crypto | ✔️ | ✔️ | ✔️ | ✔️ |
javax.security | ✔️ | ✔️ | ✔️ | ✔️ |
java.sql | ✔️ | ✔️ | ✔️ | |
javax.sql | ✔️ | ✔️ | ✔️ | |
javax.xml | ✔️ | ✔️ | ✔️ | |
org.w3c.dom | ✔️ | ✔️ | ✔️ | |
org.xml.sax | ✔️ | ✔️ | ✔️ | |
java.rmi | ✔️ | ✔️ | ✔️ | |
javax.rmi | ✔️ | ✔️ | ✔️ | |
javax.transaction | ✔️ | ✔️ | ✔️ | |
java.lang.management | ✔️ | ✔️ | ||
javax.management | ✔️ | ✔️ | ||
javax.naming | ✔️ | ✔️ | ||
javax.sql.rowset | ✔️ | ✔️ | ||
javax.security.auth.kerberos | ✔️ | ✔️ | ||
org.ietf.jgss | ✔️ | ✔️ | ||
javax.script | ✔️ | ✔️ | ||
javax.xml.crypto | ✔️ | ✔️ | ||
java.util.prefs | ✔️ | ✔️ | ||
javax.security.sasl | ✔️ | ✔️ | ||
javax.security.acl | ✔️ | ✔️ | ||
java.lang.instrument | ✔️ | ✔️ | ||
javax.annotation.processing | ✔️ | ✔️ | ||
javax.lang.model | ✔️ | ✔️ | ||
javax.lang.model.element | ✔️ | ✔️ | ||
javax.lang.model.type | ✔️ | ✔️ | ||
javax.lang.model.util | ✔️ | ✔️ | ||
javax.tools | ✔️ | ✔️ | ||
corba | ✔️ | |||
awt | ✔️ | |||
swing | ✔️ |
NetBeans IDE has the option to configure your Java Profile.
There is your "Profiles" drop-down menu.
And you will not see this "Profiles" item if you choose a Maven-based project instead.
So, the bottom line is: this comes down to whether you choose to create an Ant-based project or a Maven (or Gradle) based project.
One obvious follow-on question is "Why?"
I do not know (hence that first sentence in my answer).
I suspect it is a legacy attribute of NetBeans with Ant-based projects.
It's possible that the distinction between Compact1, Compact2, Compact3, and Full JRE has become increasingly irrelevant in later versions of Java. The following may be a bit speculative - I'd be happy to be corrected:
Java (mostly) no longer ships with a separate JDK vs. JRE version. See When was JRE discontinued as a separate offering? Some offerings still provide a separate JDK and JRE, but others no longer do. It's posible this is not directly relevant to your question, but I wanted to mention it.
The transition of many
javax
packages tojakarta
has eroded the difference between these Java "Profiles" in NetBeans. See Transition from Java EE to Jakarta EEThe introduction of Java modules in Java 9 provides more finer-grained control over which packages you choose to include in your application. See Java Modules and many other tutorials and guides.
Final note: On a personal level (anecdotal evidence based on a sample size of 1) I have never needed to worry about the size of the Java core library.