Using the Console Application Template

Thanks for using this pre-release version of Visual J++.

Use this procedure to create a basic Java console application. The following procedure will run the application from the development environment. To run the application from the command line, see Viewing Applications with JVIEW or Viewing Applications with WJVIEW.

Tip Before beginning the following procedure, close all open projects by clicking Close Project on the File menu for each open project.

To create a basic Java console application

  1. On the File menu, click New Project.

    The New Project dialog box appears.

  2. On the New tab, click the ô+ö sign to the left of the Visual J++ Projects folder to display additional folders for specific types of Visual J++ projects.

    Folders for Web Pages, Applications, and Components appear.

  3. Open the Applications folder.

    Application Wizard, Console Application, and Windows Application icons appear in the rightmost pane of the New Project dialog.

  4. Click the Console Application icon.

  5. Enter a name for your application project into the Name text box.

  6. Click Open.

    A collapsed view of your application project appears in the Project Explorer.

  7. Expand the project icon by clicking the ô+ö sign to the left of your projectÆs name in the Project Explorer.

  8. To view your applicationÆs code, highlight the applicationÆs .java file, and click View Code on the shortcut menu.

    The applicationÆs code appears in an interactive Text Editor where you can modify the code.

  9. Add the following code inside the main() method of your application:
    String str = "The quick brown fox jumped over the lazy yellow dog.";
    
    System.out.println("The string is: " + str);
    System.out.println("The length of the string is: " + str.length());
    System.out.println("The substring from positions 10 to 20 is: + 
    str.substring(10,20));
    System.out.println("The upper case string is: " + 
    str.toUpperCase());
    

To see the results of the code youÆve added to the template, you will need to compile and run the applet. See Building and Running a Console Application for the procedures to walk you through this process.