make/jdk/netbeans/awt2d/README
changeset 47216 71c04702a3d5
parent 19870 19ebc43b932b
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 Working on  AWT and Java2D code with NetBeans
       
     2 
       
     3   This project includes most of Java2D and AWT-related files,
       
     4   allows easy navigation and builds from within NetBeans.
       
     5   
       
     6   Since both AWT and Java2D have lots of native code, this
       
     7   project uses "make" targets for building.
       
     8   
       
     9   Unfortunately currently this project doesn't support
       
    10   working with native code. Meaning, there is no navigation, code 
       
    11   completion, refactoring, etc.
       
    12   In the future we will provide native code support.
       
    13   
       
    14   You can certainly install the C/C++ pack for NetBeans 6.0
       
    15   once it becomes available, or use any other editor for
       
    16   working with C/C++ files.
       
    17   
       
    18   In order to use this project from within NetBeans you will have 
       
    19   to perform a full jdk build first.
       
    20   
       
    21 Here are the steps:
       
    22    1. setup your jdk build environment as described in 
       
    23       other documents (see build documentation)
       
    24   
       
    25    2. perform a full jdk build (preferably a FASTDEBUG build,
       
    26       as it simplifies the debugging - the classes and object files
       
    27       will be built with the debug information). 
       
    28       You only need to build jdk's "all" target:
       
    29         #> cd jdk/make
       
    30         #> make all > build.log 2>&1
       
    31   
       
    32    3. set "make" and "make.options"  properties in your 
       
    33       ~/.openjdk/build.properties file (see the main README 
       
    34       file for more information on property files)
       
    35       to set up the environment in NetBeans.
       
    36 
       
    37       To get a list of variables you most likely will need to override
       
    38       to make the the build work in NetBeans, you can do something like this 
       
    39       (on Windows):
       
    40         #>env | grep ALT
       
    41         ALT_JDK_IMPORT_PATH=c:/devtools/java/jdk1.7.0
       
    42         ALT_BOOTDIR=c:/DevTools/java/jdk1.6.0
       
    43 
       
    44       If your build is a FASTDEBUG build, don't forget
       
    45       to set FASTDEBUG=true in the property file as well so that what you 
       
    46       have built from the terminal matches what will be built from NetBeans.
       
    47 
       
    48       Set "make.options" in your build.properties
       
    49       accordingly:
       
    50         make.options=\
       
    51             ALT_JDK_IMPORT_PATH=c:/devtools/java/jdk1.7.0 \
       
    52             ALT_BOOTDIR=c:/DevTools/java/jdk1.6.0 \
       
    53             FASTDEBUG=true
       
    54         make=c:/devtools/cygwin/bin/make
       
    55 
       
    56    4. Windows only: make sure you either call vcvars32.bat
       
    57       file which sets the compiler environment
       
    58       (typically located in <YourVisualStudioInstallDir>/VC7/bin)
       
    59       and start NetBeans from the same terminal,
       
    60       or make Visual Studio register its environment
       
    61       variables globally.
       
    62       (When building on 64-bit Windows platform, use setenv.cmd
       
    63        from Platform SDK instead of vcvars32, as described in the 
       
    64        build documentation)
       
    65 
       
    66    5. Now you can launch NetBeans
       
    67 
       
    68 Notes on building the project from NetBeans
       
    69 
       
    70   If you work only with Java files, you can compile them
       
    71   with "Compile Single File" target ("F9" by default), the ant build
       
    72   will compile the class files into the correct directory automatically.
       
    73 
       
    74   However, if you touched any of C/C++ files, 
       
    75   you will need to use "build main project" ("F11") which launches
       
    76   "make" on a set of directories.
       
    77   
       
    78   Same goes if you touched a Java file which has native
       
    79   methods. You will need to run the build so that
       
    80   "javah" can generate the JNI header files used by 
       
    81   the native code.
       
    82 
       
    83 Demos
       
    84 
       
    85   The default run target for this project is Font2DTest,
       
    86   which is launched with the runtime you built.
       
    87 
       
    88   You can also start other demos by selecting a demo
       
    89   in the Project or Files view and choosing "Run" from 
       
    90   the menu.
       
    91   
       
    92   In particular, there is a J2DBench demo project, 
       
    93   which is a Java2D benchmark. To run it,
       
    94   select java2d.J2DBench/build.xml node in the
       
    95   "Projects" explorer and execute "Run" target.
       
    96   For more information on this benchmark, see
       
    97   the project's README file in the "Files" view.
       
    98 
       
    99 Notes on using CND (C/C++ pack) with this project and NetBeans.
       
   100 
       
   101   As mentioned above currently a project for working with native code is not 
       
   102   provided. However, you can set it up by yourself if you have 
       
   103   access to CND pack for NetBeans 6.0.
       
   104 
       
   105   First, install CND as described here (this is a page for CND 5.5,
       
   106   there likely will be one for 6.0 as well):
       
   107     http://www.netbeans.org/community/releases/55/cnd-install.html
       
   108   and make sure everyting works it works.
       
   109 
       
   110   Then, create a new C/C++ project of "from existing code" type (see page 
       
   111   mentioned above for examples). The project should be located in the same 
       
   112   directoryas this project is - on the same level. Call it something like 
       
   113   "awt2d-native-${platform}-${arch}". So, for example, you may have
       
   114     jdk/make/netbeans/awt2d
       
   115     jdk/make/netbeans/awt2d-native-windows-i586
       
   116 
       
   117   Specify the top level Makefile (jdk/make/Makefile), even though
       
   118   you will not be using, as the Java awt2d project is set up
       
   119   for building the workspace (thus make sure it's the default project,
       
   120   so when you hit "Build Project" it's awt2d one that's chosen).
       
   121 
       
   122   The most important thing is to specify the directories which will
       
   123   be included into this project, the defines, and the directories for 
       
   124   include files.
       
   125   This will enable code completion and limited navigation.
       
   126 
       
   127   Using the project wizard, select the source directories you're interested in.
       
   128 
       
   129   For example, 
       
   130    src/share/native/sun/java2d
       
   131    src/windows/native/sun/java2d
       
   132    ....
       
   133   (this will recursively include the subdirectories)
       
   134 
       
   135   Then set the list of the includes required by CND to enable code assistance.
       
   136   You can get a complete list of include directories by looking at your
       
   137   build log file and checking what directories are included with "-I" when 
       
   138   the files you're interesed in are built (you can probably devise some
       
   139   script to generate the list of include files relative to the native
       
   140   cnd project directory, and the list of defines passed to the compiler)
       
   141 
       
   142   For example, on Windows x86, you might have something like this
       
   143   (a somewhat complete list of awt and 2d native directories on windows):
       
   144 
       
   145   ../../src/share/javavm/export;
       
   146   ../../src/share/native/common;
       
   147   ../../src/share/native/sun/awt/debug;
       
   148   ../../src/share/native/sun/awt/image/cvutils;
       
   149   ../../src/share/native/sun/awt/image;
       
   150   ../../src/share/native/sun/awt/medialib;
       
   151   ../../src/share/native/sun/awt;
       
   152   ../../src/share/native/sun/font/bidi;
       
   153   ../../src/share/native/sun/font/layout;
       
   154   ../../src/share/native/sun/font;
       
   155   ../../src/share/native/sun/java2d/cmm/lcms;
       
   156   ../../src/share/native/sun/java2d/cmm;
       
   157   ../../src/share/native/sun/java2d/loops;
       
   158   ../../src/share/native/sun/java2d/opengl;
       
   159   ../../src/share/native/sun/java2d/pipe;
       
   160   ../../src/share/native/sun/java2d;
       
   161   ../../src/windows/javavm/export;
       
   162   ../../src/windows/native/common;
       
   163   ../../src/windows/native/sun/awt;
       
   164   ../../src/windows/native/sun/java2d/d3d;
       
   165   ../../src/windows/native/sun/java2d/opengl;
       
   166   ../../src/windows/native/sun/java2d/windows;
       
   167   ../../src/windows/native/sun/java2d;
       
   168   ../../src/windows/native/sun/windows;
       
   169   ../../build/windows-i586/tmp/sun/sun.awt/awt/CClassHeaders;
       
   170   ../../build/windows-i586/tmp/sun/sun.awt/awt/obj;
       
   171   ../../build/windows-i586/tmp/sun/sun.awt/awt/obj_gO;
       
   172   ../../build/windows-i586/tmp/sun/sun.awt/jpeg/CClassHeaders;
       
   173   ../../build/windows-i586/tmp/sun/sun.awt/splashscreen/CClassHeaders;
       
   174   ../../build/windows-i586/tmp/sun/sun.font/fontmanager/CClassHeaders;
       
   175   ../../build/windows-i586/tmp/sun/sun.font/t2k/CClassHeaders;
       
   176   C:/devtools/VS2003/SDK/v1.1/include;
       
   177   C:/devtools/VS2003/VC7/ATLMFC/INCLUDE;
       
   178   C:/devtools/VS2003/VC7/INCLUDE;
       
   179   C:/devtools/VS2003/VC7/PlatformSDK/include;
       
   180   C:/devtools/VS2003/VC7/PlatformSDK/include/prerelease;
       
   181 
       
   182   (you can format this into a single line with ';' delimiters and paste it
       
   183   into the text field instead of entering them one by one)
       
   184 
       
   185   Note that most paths are relative to the native project directory - 
       
   186   this helps if you decide to relocate the workspace later. The ones that 
       
   187   aren't relative are paths to external include directories, like those 
       
   188   of the Platform SDK.
       
   189   On Unix platforms these may be directories like /usr/include.
       
   190 
       
   191   The parser must know some defines to correctly parse the source files,
       
   192   these can also be obtained from the log file. For example, on Windows
       
   193   x86 with debugging enabled, the defines would be something like this:
       
   194     D3D_OVERLOADS; UNICODE; _UNICODE; WIN32; IAL; _LITTLE_ENDIAN; WIN32; _X86_; 
       
   195     x86; WIN32_LEAN_AND_MEAN; INTERNAL_BUILD; JDK_MAJOR_VERSION='"1"'; 
       
   196     JDK_MINOR_VERSION='"7"'; RELEASE=1.7.0-internal; DEBUG="true"
       
   197 
       
   198   (again, format it into a single line with '; ' delimiter - note the 
       
   199   space after ';' - and paste into the corresponding text field)
       
   200 
       
   201   Note that the list of include directories will be different on different
       
   202   platforms and architectures - consult you build log file.
       
   203 
       
   204   After the project is created a loaded, you may want to check the list
       
   205   of include files which weren't found (right-click on the native 
       
   206   project root in Projects exprorer, and select "View failed #include Directives" 
       
   207   from the popup menu. Update the inlcude directories list accordingly.
       
   208 
       
   209   You can later create a different configuration for non-debug build,
       
   210   just make a copy of your current configuration - call it ${arch}-debug
       
   211   (in the native project's Properties dialog) and remove "DEBUG=true" from
       
   212   the list of defines.
       
   213 
       
   214   Note that with both Java and native projects opened the default
       
   215   heap size NetBeans starts with might not be sufficient for comfortable work,
       
   216   so you may need to increase it. You can do it either from the command line
       
   217   or by editing your ~/.netbeans/dev/etc/netbeans.conf file and adding
       
   218   something like this:
       
   219      -J-Xms312m -J-Xmx512m -J-XX:PermSize=128m -J-XX:MaxPermSize=200m
       
   220   to netbeans_default_options property.