home *** CD-ROM | disk | FTP | other *** search
/ Java Internet Programming Reference Guide / Java Internet Programming Reference Guide.iso / autorun / java.exe / java.DXR / 00043_visualc++.txt < prev    next >
Encoding:
Text File  |  1980-01-03  |  3.1 KB  |  104 lines

  1. Using the Visual C++ IDE for Java Development
  2.  
  3.  
  4. Visual C++ 4.0, 2.0+ and 1.5+
  5.  
  6.  
  7.  
  8. Source Code Syntax Coloring: 
  9.  
  10. After opening your Java source code file in Visual C++, right click on the source code window and select C++ from the pull down list. This will enable color highlighting for the source text and although the keywords and identifiers aren't the same, comments syntax coloring is the same. Colors may be customized from the Colors property sheet in OptionsΓǪ under the Tools menu. (figure 1) 
  11.  
  12. Note: For 1.5 select C++ from the Syntax Coloring item on the View menu.
  13. For 4.0 you can permanently enable this feature by adding java to the FileExtensions entry with regedit:
  14. HKEY_CURRENT_USER->Software->Microsoft->Developer->Text Editor->Tabs/Language Settings->C/C++ 
  15.  
  16.  
  17.  
  18. <Picture>
  19. figure 1
  20.  
  21.  
  22.  
  23.  
  24.  
  25. Compiling from within the Visual C++ IDE: 
  26.  
  27. Add the javac compiler as a tool for compiling your source as follows: 
  28.  
  29. First create the following or similar batch file and place it in your java/bin directory: 
  30.  
  31.  
  32.  
  33.  
  34. @echo off
  35. echo compiling %1...
  36. c:\java\bin\javac %1
  37. echo compilation completed
  38.  
  39.  
  40.  
  41.  
  42.  
  43. This batch file will allow for adding some additional information (shown above) to the redirected output that will appear in the Output window. (for 1.5 additional modification is needed to fix long file name extensions) 
  44.  
  45. Also note that the output from javac can be redirected to a program that would format errors and warnings so that they conform to Visual C++'s format: "filename (linenum): error msg"
  46. This will allow the source window to jump to the appropriate line number.
  47. parse.exe will do this (email me for the source) as follows:
  48. c:\java\bin\javac %1 | c:\java\bin\parse 
  49.  
  50.  
  51.  
  52. Next, Select Customize from the Tools menu and on the Tools property sheet, add the batch file using the following macro arguments for the following fields: 
  53.  
  54.  
  55.  
  56.  
  57. Arguments:         $FileName       (note for 4.0 you additionally need $FileExt)
  58. Initial Directory: $FileDir
  59.  
  60.  
  61.  
  62.  
  63.  
  64. Be sure to also check the checkbox labeled: Redirect to Output Window. 
  65.  
  66. Note: For 1.5, select Tools from Options menu. Also note that redirected output is not available 
  67.  
  68.  
  69.  
  70. <Picture>
  71. figure 2
  72.  
  73.  
  74.  
  75.  
  76.  
  77. Running the Applet Viewer from within the Visual C++ IDE: 
  78.  
  79. Similarly, add the appletviewer.exe as a tool, however for the Arguments entry use the html filename you will use. This is hard coded to be something like index.html or as in the case of most of the Java SDK demos, example1.html. 
  80.  
  81. Note: if you haven't already done so, to remove the Accept/Reject licensing screen just add a .hotjava subdirectory to your main java/ directory and run the Appletviewer one more time. 
  82.  
  83.  
  84.  
  85. <Picture>
  86. figure 3
  87.  
  88.  
  89.  
  90.  
  91.  
  92. Short cuts: 
  93.  
  94. The tools added can then be run from the Tools menu (they're added at the bottom) or you can add them to the tool bar via the Toolbars property sheet (Customize from Tools menu). 
  95.  
  96.  
  97.  
  98. Additional Tools: 
  99.  
  100. Additional Tools such as a "on-line help" tool that can use the argument macro $CurText (the word under the current cursor position) can be designed that will call the appropriate link from the html documentation via DDE calls to Netscape Navigator. (in progress stay tuned) 
  101.  
  102.  
  103.  
  104.