Export (0) Print
Expand All

How to: Compile a Java-language Application in Visual J#

Visual Studio 2005

You can compile many of your Java Development Kit (JDK) 1.2 applications seamlessly in J#. Applications use Abstract Window Toolkit (AWT) or native java functionality compile with little or no manual upgrading.

The following procedure shows you how to create your own project, add your existing .java files, and compile them with J#.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To compile your JDK application in Visual J#

  1. Create a new console application.

    The console application displays a default J# application file. Since your application is not currently working with J#, the Program.jsl is not necessary.

  2. In Solution Explorer, right-click on the Program.jsl file and point to Exclude From Project.

    Visual Studio removes the Program.jsl from the project without deleting the file. When you compile, the Program.jsl will not be included in the list of files to build. If you change your mind and would like to add the Program.jsl back into the project, you may do so. You may add any kind of file, however, Visual J# will only compile files with the .java or .jsl extensions.

  3. Right-click on the project name, point to Add, and then Existing Item to add your .java files to the project.

  4. Ctrl + Click on one or more existing.java files.

  5. Press OK to add them to the new project.

    The files you just added display in the Solution Explorer.

  6. Click File and Save All to store the project.

  7. Right-click on the project name and point to Properties.

    The Configuration dropdown list shows which configuration is active.

  8. In the Configuration dropdown list select Debug or Release.

    When you compile with the Debug configuration, the compiler adds symbols for stepping through the code. The Release configuration creates a smaller assembly for distribution.

  9. Press F5 to run compile and run the program.

    -or-

    Click Debug Start.

    -or-

    Click Build Solution.

    Visual J# compiles the project and places the .exe assembly in the bin\debug directory depending on the configuration setting.

  10. At the bottom of the screen, review the compiler status in Output window.

  11. If the program did not compile, click on the Error tab for details.

  12. Highlight the error, and press F1 for detailed help about how to correct the problem.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft