Select
File
> New...
> Java Script (.java) from the main menu bar.
The
New Java Script dialog appears.
Enter a name for your Java class.
Click
OK.
A Java file containing a class with the given name is generated and opened.
When saving a new Java file for the first time, you are asked if you want to add the file to the current project. Click
Yes.
There are two other ways you can add Java files to your project:
Right-click the
Scripts subnode of the project and select
Add Existing Script... to open the
Select Script(s) dialog. Change the
File of type list box selection to
Java files (*.java). Select your file, which will be added to the project when you click
Open.
Right-click in Java file view to open the context menu. Click
Add to Project to add the file to the project.