0N/AWorking on AWT and Java2D code with NetBeans
0N/A
0N/A This project includes most of Java2D and AWT-related files,
0N/A allows easy navigation and builds from within NetBeans.
0N/A
0N/A Since both AWT and Java2D have lots of native code, this
0N/A project uses "make" targets for building.
0N/A
0N/A Unfortunately currently this project doesn't support
0N/A working with native code. Meaning, there is no navigation, code
0N/A completion, refactoring, etc.
0N/A In the future we will provide native code support.
0N/A
0N/A You can certainly install the C/C++ pack for NetBeans 6.0
0N/A once it becomes available, or use any other editor for
0N/A working with C/C++ files.
0N/A
0N/A In order to use this project from within NetBeans you will have
0N/A to perform a full jdk build first.
0N/A
0N/AHere are the steps:
0N/A 1. setup your jdk build environment as described in
0N/A other documents (see build documentation)
0N/A
0N/A 2. perform a full jdk build (preferably a FASTDEBUG build,
0N/A as it simplifies the debugging - the classes and object files
0N/A will be built with the debug information).
0N/A You only need to build jdk's "all" target:
0N/A #> cd jdk/make
0N/A #> make all > build.log 2>&1
0N/A
0N/A 3. set "make" and "make.options" properties in your
0N/A ~/.openjdk/build.properties file (see the main README
0N/A file for more information on property files)
0N/A to set up the environment in NetBeans.
0N/A
0N/A To get a list of variables you most likely will need to override
0N/A to make the the build work in NetBeans, you can do something like this
0N/A (on Windows):
0N/A #>env | grep ALT
0N/A ALT_JDK_IMPORT_PATH=c:/devtools/java/jdk1.7.0
0N/A ALT_DXSDK_PATH=c:/devtools/DirectX/DXSDK_Dec06
0N/A ALT_BOOTDIR=c:/DevTools/java/jdk1.6.0
0N/A
0N/A If your build is a FASTDEBUG build, don't forget
0N/A to set FASTDEBUG=true in the property file as well so that what you
0N/A have built from the terminal matches what will be built from NetBeans.
0N/A
0N/A Set "make.options" in your build.properties
0N/A accordingly:
0N/A make.options=\
0N/A ALT_JDK_IMPORT_PATH=c:/devtools/java/jdk1.7.0 \
0N/A ALT_DXSDK_PATH=c:/devtools/DirectX/DXSDK_Dec06 \
0N/A ALT_BOOTDIR=c:/DevTools/java/jdk1.6.0 \
0N/A FASTDEBUG=true
0N/A make=c:/devtools/cygwin/bin/make
0N/A
0N/A 4. Windows only: make sure you either call vcvars32.bat
0N/A file which sets the compiler environment
0N/A (typically located in <YourVisualStudioInstallDir>/VC7/bin)
0N/A and start NetBeans from the same terminal,
0N/A or make Visual Studio register its environment
0N/A variables globally.
0N/A (When building on 64-bit Windows platform, use setenv.cmd
0N/A from Platform SDK instead of vcvars32, as described in the
0N/A build documentation)
0N/A
0N/A 5. Now you can launch NetBeans
0N/A
0N/ANotes on building the project from NetBeans
0N/A
0N/A If you work only with Java files, you can compile them
0N/A with "Compile Single File" target ("F9" by default), the ant build
0N/A will compile the class files into the correct directory automatically.
0N/A
0N/A However, if you touched any of C/C++ files,
0N/A you will need to use "build main project" ("F11") which launches
0N/A "make" on a set of directories.
0N/A
0N/A Same goes if you touched a Java file which has native
0N/A methods. You will need to run the build so that
0N/A "javah" can generate the JNI header files used by
0N/A the native code.
0N/A
0N/ADemos
0N/A
0N/A The default run target for this project is Font2DTest,
0N/A which is launched with the runtime you built.
0N/A
0N/A You can also start other demos by selecting a demo
0N/A in the Project or Files view and choosing "Run" from
0N/A the menu.
0N/A
0N/A In particular, there is a J2DBench demo project,
0N/A which is a Java2D benchmark. To run it,
0N/A select java2d.J2DBench/build.xml node in the
0N/A "Projects" explorer and execute "Run" target.
0N/A For more information on this benchmark, see
0N/A the project's README file in the "Files" view.
0N/A
0N/ANotes on using CND (C/C++ pack) with this project and NetBeans.
0N/A
0N/A As mentioned above currently a project for working with native code is not
0N/A provided. However, you can set it up by yourself if you have
0N/A access to CND pack for NetBeans 6.0.
0N/A
0N/A First, install CND as described here (this is a page for CND 5.5,
0N/A there likely will be one for 6.0 as well):
0N/A http://www.netbeans.org/community/releases/55/cnd-install.html
0N/A and make sure everyting works it works.
0N/A
0N/A Then, create a new C/C++ project of "from existing code" type (see page
0N/A mentioned above for examples). The project should be located in the same
0N/A directoryas this project is - on the same level. Call it something like
0N/A "awt2d-native-${platform}-${arch}". So, for example, you may have
0N/A jdk/make/netbeans/awt2d
0N/A jdk/make/netbeans/awt2d-native-windows-i586
0N/A
0N/A Specify the top level Makefile (jdk/make/Makefile), even though
0N/A you will not be using, as the Java awt2d project is set up
0N/A for building the workspace (thus make sure it's the default project,
0N/A so when you hit "Build Project" it's awt2d one that's chosen).
0N/A
0N/A The most important thing is to specify the directories which will
0N/A be included into this project, the defines, and the directories for
0N/A include files.
0N/A This will enable code completion and limited navigation.
0N/A
0N/A Using the project wizard, select the source directories you're interested in.
0N/A
0N/A For example,
0N/A src/share/native/sun/java2d
0N/A src/windows/native/sun/java2d
0N/A ....
0N/A (this will recursively include the subdirectories)
0N/A
0N/A Then set the list of the includes required by CND to enable code assistance.
0N/A You can get a complete list of include directories by looking at your
0N/A build log file and checking what directories are included with "-I" when
0N/A the files you're interesed in are built (you can probably devise some
0N/A script to generate the list of include files relative to the native
0N/A cnd project directory, and the list of defines passed to the compiler)
0N/A
0N/A For example, on Windows x86, you might have something like this
0N/A (a somewhat complete list of awt and 2d native directories on windows):
0N/A
0N/A ../../src/share/javavm/export;
0N/A ../../src/share/native/common;
0N/A ../../src/share/native/sun/awt/debug;
0N/A ../../src/share/native/sun/awt/image/cvutils;
0N/A ../../src/share/native/sun/awt/image;
0N/A ../../src/share/native/sun/awt/medialib;
0N/A ../../src/share/native/sun/awt;
0N/A ../../src/share/native/sun/font/bidi;
0N/A ../../src/share/native/sun/font/layout;
0N/A ../../src/share/native/sun/font;
0N/A ../../src/share/native/sun/java2d/cmm/lcms;
0N/A ../../src/share/native/sun/java2d/cmm;
0N/A ../../src/share/native/sun/java2d/loops;
0N/A ../../src/share/native/sun/java2d/opengl;
0N/A ../../src/share/native/sun/java2d/pipe;
0N/A ../../src/share/native/sun/java2d;
0N/A ../../src/windows/javavm/export;
0N/A ../../src/windows/native/common;
0N/A ../../src/windows/native/sun/awt;
0N/A ../../src/windows/native/sun/java2d/d3d;
0N/A ../../src/windows/native/sun/java2d/opengl;
0N/A ../../src/windows/native/sun/java2d/windows;
0N/A ../../src/windows/native/sun/java2d;
0N/A ../../src/windows/native/sun/windows;
0N/A ../../build/windows-i586/tmp/sun/sun.awt/awt/CClassHeaders;
0N/A ../../build/windows-i586/tmp/sun/sun.awt/awt/obj;
0N/A ../../build/windows-i586/tmp/sun/sun.awt/awt/obj_gO;
0N/A ../../build/windows-i586/tmp/sun/sun.awt/jpeg/CClassHeaders;
0N/A ../../build/windows-i586/tmp/sun/sun.awt/splashscreen/CClassHeaders;
0N/A ../../build/windows-i586/tmp/sun/sun.font/fontmanager/CClassHeaders;
0N/A ../../build/windows-i586/tmp/sun/sun.font/t2k/CClassHeaders;
0N/A C:/DevTools/DirectX/DXSDK_Dec06/Include;
0N/A C:/devtools/VS2003/SDK/v1.1/include;
0N/A C:/devtools/VS2003/VC7/ATLMFC/INCLUDE;
0N/A C:/devtools/VS2003/VC7/INCLUDE;
0N/A C:/devtools/VS2003/VC7/PlatformSDK/include;
0N/A C:/devtools/VS2003/VC7/PlatformSDK/include/prerelease;
0N/A
0N/A (you can format this into a single line with ';' delimiters and paste it
0N/A into the text field instead of entering them one by one)
0N/A
0N/A Note that most paths are relative to the native project directory -
0N/A this helps if you decide to relocate the workspace later. The ones that
0N/A aren't relative are paths to external include directories, like those
0N/A of the Platform SDK, DirectX SDK.
0N/A On Unix platforms these may be directories like /usr/include.
0N/A
0N/A The parser must know some defines to correctly parse the source files,
0N/A these can also be obtained from the log file. For example, on Windows
0N/A x86 with debugging enabled, the defines would be something like this:
0N/A D3D_OVERLOADS; UNICODE; _UNICODE; WIN32; IAL; _LITTLE_ENDIAN; WIN32; _X86_;
0N/A x86; WIN32_LEAN_AND_MEAN; INTERNAL_BUILD; JDK_MAJOR_VERSION='"1"';
0N/A JDK_MINOR_VERSION='"7"'; RELEASE=1.7.0-internal; DEBUG="true"
0N/A
0N/A (again, format it into a single line with '; ' delimiter - note the
0N/A space after ';' - and paste into the corresponding text field)
0N/A
0N/A Note that the list of include directories will be different on different
0N/A platforms and architectures - consult you build log file.
0N/A
0N/A After the project is created a loaded, you may want to check the list
0N/A of include files which weren't found (right-click on the native
0N/A project root in Projects exprorer, and select "View failed #include Directives"
0N/A from the popup menu. Update the inlcude directories list accordingly.
0N/A
0N/A You can later create a different configuration for non-debug build,
0N/A just make a copy of your current configuration - call it ${arch}-debug
0N/A (in the native project's Properties dialog) and remove "DEBUG=true" from
0N/A the list of defines.
0N/A
0N/A Note that with both Java and native projects opened the default
0N/A heap size NetBeans starts with might not be sufficient for comfortable work,
0N/A so you may need to increase it. You can do it either from the command line
0N/A or by editing your ~/.netbeans/dev/etc/netbeans.conf file and adding
0N/A something like this:
0N/A -J-Xms312m -J-Xmx512m -J-XX:PermSize=128m -J-XX:MaxPermSize=200m
0N/A to netbeans_default_options property.