FeaturesPluginsDocs & SupportCommunityPartners

Using NetBeans C/C++ development pack to work with OpenJDK HotSpot project

Links

HotSpot under NB project http://cnd.netbeans.org/docs/hotspot-projects

OpenJDK - HotSpot http://openjdk.java.net/groups/hotspot/ Since May, 2007 Sun opens almost all of the JDK under the GPL 6.5 HotSpot part of it handles Java virtual machine sources.

NetBeans IDE http://www.netbeans.org/products/ide/

NetBeans C/C++ development pack http://www.netbeans.org/products/cplusplus/ The NetBeans C/C++ Development Pack provides C and C++ development support to the NetBeans community.

SunStudio http://developers.sun.com/sunstudio/downloads/ For compilers required to build HotSpot.

Requirements

  • You need to have NetBeans IDE with C/C++ NetBeans development pack installed. Follow instructions here if you don't have one.
  • Your machine have to fulfil the requirements to compile HotSpot. Usually it's enough to have linux-intel or solaris-intel machine with SunStudio installed and JDK 1.5 or later. You can find more details here.

Content

  • NB projects for Solaris-intel/sparc or Linux configuration
  • Readme

Preparing sources to use with premade NB projects

  1. Premade projects were created for HotSpot build b16 from July 20, 2007. But they should work for later builds as well.
  2. Download and unpack to the same folder
  3. Check if your HotSpot sources are writable. If not run next command on hotspot folder:
    chmod a+rw hotspot
  4. Copy hotspot folder from preconfigured folder according to your system.
    E.g. for solaris system you can run next command from the folder you've unpacked files to in step 1:
    cp -R solaris-intel/hotspot openjdk
  5. You need to build HotStop if you want to have fully functional project because HotSpot has a lot of generated sources. If you just want to browse sources you can skip this step.
    To build HotSpot
    • go to openjdk/hotspot/build/solaris
    • set JAVA_HOME variable to your JDK, e.g:
      export JAVA_HOME=/usr/java/
    • give execution rights to build.sh with command
      chmod a+x build.sh
    • run build command according to table below where <dir> is absolute path to your sources of hotspot, e.g. /export/home/openjdk/hotspot.
  6. Run NetBeans IDE with set up C/C++ development pack
  7. From NB open folder openjdk/hotspot/build. Choose one of next projects:
       | Project for | Path to projects                       | Build Command
       ----------------------------------------------------------------------------
          server       solaris_i486_compiler2/projects/hotspot  build.sh jvmg <dir>
          client       solaris_i486_compiler1/projects/hotspot  build.sh jvmg1 <dir>
          core         solaris_i486_core/projects/hotspot       build.sh jvmgcore <dir>
          tiered       solaris_i486_tiered/projects/hotspot     build.sh jvmgtiered <dir>
                    

Troubleshooting

  • Makefile: Unexpected end of line
    Reason: you are using dmake or make by default, but HotSpot require gmake (gnumake) to handle it's Makefiles
    Solution:
    • before building HotSpot you have to run next command:
      export MAKE=gmake
    • in NetBeans IDE go to "Tools/Options" -> "C/C++ Setings" and change "make command" field to "gmake"

  • Build reports compilers incompatibility
    Reason: most likely you are using last Sun compilers version 5.9 and HotSpot wants 5.8 by default
    Solution:
    • in most cases 5.9 works the same way, run next commands to force build scripts to use 5.9:
      export ENFORCE_COMPILER_REV=5.9
      export ENFORCE_C_COMPILER_REV=5.9
    • if you would experience this problem in the IDE go to "Project Properties -> Make" and add next string to "build command" and "clean command" fields:
      ENFORCE_COMPILER_REV=5.9 ENFORCE_C_COMPILER_REV=5.9
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by