Issue
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.
Their Overview of JDK 8 Support in NetBeans IDE page has the best explanation on the different profiles, and why they exist. But it also documents how to configure it in the IDE.
And for me it just isn't there.
Maybe there is some obscure option that must be enabled in the web.xml
, or some other project or configuration file.
Bonus Reading
Solution
I am not sure if this is a full answer, but here is what I can share:
I have tested what you see using NetBeans v8.2 and NetBeans v13.
For the NetBeans v8.2 platform (using Java v8), when you create a new project using
File > New Project... > Java > Java Application
, that creates an Ant-based project. Creating a project in this way shows the "Profile" menu drop-down that you are asking about.If you use NetBeans v8.2, but instead choose to create a Maven-based project using
File > New Project > Maven > Java Application
, then you do not see the "Profile" menu.
So, the only difference is whether you choose an Ant (default) based project or a Maven based project.
At some point (I forget which NetBeans version), they changed the project creation menu options. For recent versions of NetBeans (at least from v12 onwards), you have to explicitly choose Ant or Maven (or Gradle) as the type of Java project you wish to create.
So, with NetBeans v13, for example, you will only see that "Profile** menu if you choose
File > New Project > Java with Ant > Java Application
. And it does not appear to matter which version of Java you use.
Here is an example from NetBeans v13, with an Ant-based project, and with Java 17:
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.
Answered By - andrewJames
Answer Checked By - Timothy Miller (JavaFixing Admin)