Poonam Bajaj's Blog

How to create VC++ project for HotSpot workspace

Poonam Parhar
Consulting Member of Technical Staff
I am sure very few people would know that on Windows platform, we can create a VC++ project for the HotSpot workspace in JDK sources. It is very useful as it gives me the ability to view and browse HotSpot source code and also build it at a simple click from Visual Studio IDE. It is also very helpful in debugging hotspot issues which can be reproduced on Windows with a simple testcase(and not just at customer site :) )
So let's see how we can create this project for OpenJDK hotspot workspace on 32bit platform and open it in Visual Studio.
There is a batch file 'create.bat' in \\build\\windows\\ folder which creates the VC++ project for hotspot workspace on Windows. Before we run this batch, we need to set two environment variables.
- The 32-bit OpenJDK Windows build requires Microsoft Visual Studio .NET 2003 (VS2003) Professional Edition compiler. Once the compiler is installed, we need to run VCVARS32.BAT to set the compiler environment variables
Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)
- Set the Path to include installed jdk bin folder (jdk6 or jdk7)
set PATH=D:\\Java\\jdk1.6.0_03\\bin;%PATH%
Now, run create.bat
Usage: create HotSpotWorkSpace HotSpotBuildSpace HotSpotJDKDist
This is the interactive build setup script (as opposed to the batch
build execution script). It creates HotSpotBuildSpace if necessary,
copies the appropriate files out of HotSpotWorkSpace into it, and
builds and runs MakeDeps in it. This has the side-effect of creating
the file in the build space, which is then used in Visual C++.
The HotSpotJDKDist defines place where JVM binaries should be placed.
Environment variable FORCE_MSC_VER allows to override MSVC version autodetection.
The generated project file depends upon the include databases. If
those are changed then MakeDeps is rerun.
NOTE that it is now NOT safe to modify any of the files in the build
space, since they may be overwritten whenever this script is run or
nmake is run in that directory.
Passing those required arguments:
D:\\openjdk7\\openjdk\\hotspot\\build\\windows>create.bat D:\\openjdk7\\openjdk\\hotspot d:\\hotspot\\build d:\\hotspot\\bin
Will generate VC7 project
NOTE: Using the following settings:
javac -g -d d:\\hotspot\\build\\jvmtifiles D:\\openjdk7\\openjdk\\hotspot/src/share/vm/prims/jvmtiGen.java
Generating d:\\hotspot\\build\\jvmtifiles/jvmtiEnv.hpp
Generating d:\\hotspot\\build\\jvmtifiles/jvmtiEnter.cpp
..... cut the output here ....
creating c1_ValueType.cpp
writing grand include file
writing dependencies file
Writing .vcproj file...
rm -f ad_x86_32.cpp ad_x86_32.hpp ad_x86_32_clone.cpp ad_x86_32_expand.cpp ad_x86_
d_x86_32_peephole.cpp ad_x86_32_pipeline.cpp adGlobals_x86_32.hpp dfa_x86_32.cpp
adlc -q -T -U_LP64 x86_32.ad
This creates vm.vcproj file in d:\\hotspot\\build folder.
Open this in Visual Studio .Net and have fun!

Join the discussion

Comments ( 4 )
  • FredAtMicrosoft Monday, March 10, 2008

    Cheers on the info!


    Fred Reckling

    Microsoft 2008 Joint Launch Team


  • Eric Friday, March 18, 2011

    according to the steps above, i can't create VC++ projects

    D:\\openjdk7\\openjdk\\hotspot\\build\\windows>create.bat D:\\openjdk7\\openjdk\\hotspot d:\\hotspot\\build d:\\hotspot\\bin

    for the step i got no output, neither any error message

  • Kishor Tuesday, November 8, 2016

    Thanks for the instructions. Apparently 'create.bat' is not part of JDK9. Is there an alternative script or new way of creating VS project?

  • Poonam Wednesday, January 11, 2017

    JDK 9 has configure and make build system. After configure, you can use

    # make hotspot

    to build hotspot and can use

    # make hotspot-ide-project

    to create the hotspot VS project.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.