Creating an Empty Project

See Also

When you create a project in Visual J++, you can use one of the code templates, run the Application Wizard, or create an empty project. When you use the code templates or the wizard, your Java source files use the default names, such as Form1.java or Class1.java. Renaming the file does not automatically rename the associated Java class in the code, and vice versa; you must manually change all instances of the old name. However, creating an empty project provides the flexibility of initially naming your Java source files when you add them.

Note   Before you use the following procedure to create an empty project, close any projects that you may already have open. (On the File menu, click Close All.)

To create an empty project

  1. On the File menu, click New Project.

  2. On the New tab, click the Visual J++ Projects folder. Then select the Empty Project icon.

  3. In the Name box, enter a name for your project.

  4. In the Location box, enter the path where you want to save your project, or click Browse to navigate to the folder.

  5. Click Open. Your project appears in Project Explorer, and contains no files.

To add a form or control to the project

  1. In Project Explorer, right-click the name of your project. Point to Add on the shortcut menu and then click Add Form.

  2. To add a WFC form, select the Form icon. Your Java class extends com.ms.wfc.ui.Form. (You can also select the Data Form Wizard icon to automatically generate a data-bound form.)

  3. To add a control, select the Control icon. Your Java class extends com.ms.wfc.ui.UserControl.

  4. In the Name box, enter a name for the Java class.

  5. Click Open.

For more information about WFC forms, and for a simple example that shows how to modify a form, see Creating a Windows Application with WFC.

To add a Java class to the project

  1. In Project Explorer, right-click the name of your project. Point to Add on the shortcut menu and then click Add Class.

  2. To add an empty Java class, select the Class icon. (You can later modify this class to create a COM DLL, a Dynamic HTML application, or an applet.)

  3. To add a Java class that contains a main method (such as to create a console application), select the ClassMain icon.

  4. In the Name box, enter a name for the Java class.

  5. Click Open.

To add an HTML page to the project

  1. In Project Explorer, right-click the name of your project. Point to Add on the shortcut menu and then click Add Web Page.

  2. Select the Page icon to add an HTML page.

  3. In the Name box, enter a name for the page.

  4. Click Open.

To import a COM DLL into the project

  1. In Project Explorer, right-click the name of your project. Point to Add on the shortcut menu and then click Add COM Wrapper.

  2. In the COM Wrappers dialog box, select the type library that you want to import.

  3. Click OK.

Note   By default, when you create a project with the Empty Project icon, your project will not be packaged when you build it. However, if you are creating a Windows application with WFC, you may want to package your project into an .exe file that can be run from the command line; if you are creating a COM DLL, you need to package your project into the DLL format. For more information, see Packaging and Deploying Projects.