Aftera little bit of googling I know, that: [1] By choosing a Java Platform I declare the minimum Java version which can run my jar file. I can't run my jar with Java 6 when I set the project's JDK to 7 or 8.[2] Second option ensures that I compile my sources with specified java version. Moreover, netbeans will check if I do not use any syntax unavailable in a specified java.
However there is one thing I do not understand and it forces me to think, that I make somewhere a mistake... Namely, it is possible to set, for instance, Java 8 as a Java Platform (so my app is compatible with Java 8+) but in source/binary format I can choose Java 6 or even Java 5. Why such a configuration is possible? What are the advantages of writing a source code using syntax from Java 6 when I use a Java 8 as a project's Java Platform??
When you create a project in an IDE, it generates an Ant script to build the application. Alternatively, IDEs also support Maven. For more information about Ant and Maven, see their respective official web sites:
NetBeans IDE includes various project types that are preconfigured for developing Java SE, JavaFX, Java ME, and many other types of applications. Each type includes template source files and settings that are specific to the development platform.
When creating a project in NetBeans IDE, you specify the location and name of the project folder. By default, the src folder is created inside the project folder for all source packages. You can add other folders with source code files and packages that you want to be part of the project.
The sources for a project are maintained in the form of a list of folders with source code files and packages. The order of the folders in the list defines the order in which the folders are processed (that is, source files are compiled).
For each source package folder, you can define a label that is displayed in the Projects view. For example, the default src folder is labeled Source Packages. By default, all added folders are labeled with the name of the folder. To change a label, double-click it, enter a name, and press Enter.
If you are developing an application that must be compatible with previous versions of Java, you can set the version of the source code that the compiler should expect, and the target runtime version for which you want to compile.
The Java SE Development Kit (JDK) is used to compile and package a Java ME Embedded application, while the Java ME Embedded platform included with Oracle Java ME SDK provides an emulation environment for Windows to run the application on an emulated device.
You can select both the JDK and the Java ME platform for a Java ME Embedded Application project when creating the project. To select the JDK and the Java ME platform for an existing Java ME Embedded Application project:
When you install NetBeans IDE, it automatically detects and registers all Java platforms on your computer. You can use the Java Platform Manager to manually register other platforms in NetBeans IDE as necessary. To access the Java Platform Manager do one of the following:
The Java ME platform includes an emulation environment that provides implementations of the device's APIs. For example, Oracle Java ME SDK8.3 includes the Java ME Embedded 8.3 runtime as an emulation environment for Windows and Linux.
Because Java ME Embedded 8.3 implements only JSR 360: Connected Limited Device Configuration 8 (CLDC 8) and JSR 361: Java ME Embedded Profile (MEEP 8), the Configuration and Profile options do not provide any alternatives.
Various devices may implement optional application programming interfaces (APIs) to provide specific functionality (for example, wireless communication or physical location tracking). By default, all optional packages available to the platform are selected for a project. However, if a device does not support some of the APIs, you can exclude corresponding packages to reduce the size of the application.
A project may depend on classes, associated source files, annotation processors, and Javadoc documentation from another project, library, Java Archive (JAR), or any other location. These dependencies (also known as libraries) are added to the class path so that they can be accessed during compilation. The list of libraries defines the -classpath, -sourcepath, and -processorpath options of the javac Java compiler.
To manage these libraries for an existing Java ME Embedded Application project, right-click the project, select Properties, and then open the Libraries category. The following tabs are available in the Libraries category:
Processor: This tab is used to manage the list of processor-path libraries that define the location of the annotation processors used in the project. If no libraries are specified or the processor is not available in the specified libraries, then the general compile-time class path is searched for annotation processors.
LIBlets: This tab is used to manage the list of shareable software components that a Java ME Embedded application may use at runtime. To customize LIBlet-specific options in this tab, add LIBlets of type liblet as compile-time libraries on the Compile tab.
To edit a library, select it in the list and click Edit. To remove a library, select it in the list and click Remove. If there are multiple libraries on which a project depends, you can define the order in which they are searched for the corresponding dependencies using the Move Up and Move Down buttons.
If there are source code files in the libraries that are associated with a project, they have to be built to be used. The Build Projects on Classpath check box is selected by default to enable all project dependencies to be built if they are on the class path. If you know that your project does not require any of the source files in the dependent libraries, you can deselect this check box to decrease the time of compilation.
The basic components of a Java ME Embedded application are the Java Application Descriptor (JAD) file and the Java Archive (JAR) file. Together, these two files form an IMlet suite. Application descriptor attributes define metadata that represents the application's properties and configuration.
Attributes are contained in a JAD file, and include information, such as the name, vendor, and version of the IMlet suite, the location and size of the JAR file, and the configuration and profile requirements. The JAD file may contain any number of attributes defined by JSR 361: Java ME Embedded Profile (MEEP 8), as well as custom attributes defined by the developer of the application.
To manage application descriptor attributes for an existing Java ME Embedded Application project in NetBeans IDE, right-click the project, select Properties, and then open the Application Descriptor category. The following tabs are available in the Application Descriptor category:
Attributes: This tab is used to manage the list of name and value pairs for general attributes. If you are creating a Java ME Embedded application, select MIDlet Suite as the packaging model. If you are creating a shareable software component that an application will use during runtime, select LIBlet as the packaging model.
There are three default attributes defined that are required and cannot be removed from the list. For a MIDlet, the default attributes are MIDlet-Name, MIDlet-Vendor, and MIDlet-Version. For a LIBlet, the default attributes are LIBlet-Name, LIBlet-Vendor, and LIBlet-Version.
By default, the JAR file is located in the same folder as the JAD file. To specify a different location for the JAR file that is specified in the JAD file, select Override JAR URL in JAD under the list of general attributes, and enter an absolute or relative URL that will be used as the value for the MIDlet-Jar-URL or LIBlet-Jar-URL attribute.
MIDlets: This tab is used to manage the list of MIDlets in the suite, with a class name, a displayed name, and a displayed icon for each. At least one entry is necessary. By default, it is the main IMlet class.
Push Registry: This tab is used to manage the list of MIDlets that are registered for push notifications, with a class name, an IP address of the sender, and a connection string that identifies the protocol and port number. When you install your application on a device, the application management software (AMS) listens for incoming connections from MIDlets specified in the push registry. If a registered MIDlet connects from a matching IP address over the specified protocol to the specified port number, the AMS launches the application.
API Permissions: This tab is used to manage the list of permission attributes for protected APIs that the application uses. When you install your application on a device, the AMS compares the permissions requested with the permissions in the destination protection domain. If a required permission is denied, the installation terminates and an exception is returned. If an optional permission is denied, the application may install, but will run with limited functionality.
For a MIDlet, the first required permission entry in the list defines the MIDlet-Permission-1 attribute, the second required permission entry defines the MIDlet-Permission-2 attribute, and so on. Optional permission entries define the MIDlet-Permission-Opt-1 attribute, the MIDlet-Permission-Opt-2 attribute, and so on. For a LIBlet, corresponding attributes begin with the LIBlet-Permission-1 attribute and the LIBlet-Permission-Opt-1 attribute.
When building a Java ME Embedded Application project, NetBeans IDE automatically compiles the main IMlet class and any other necessary classes. To do this, NetBeans IDE uses the javac Java compiler from the Java SE Development Kit (JDK).
By default, a project is configured to generate all debugging information, which is defined by the -g option of the javac command. This includes information about line numbers, source files, and local variables. However, once your application is fully debugged, you should recompile it without any debugging information to make the class files smaller and harder to reverse engineer.
3a8082e126