Since people keep asking me, I thought I’d put together this quick primer on how to get started with OpenJDK Mission Control. Now, once the early access builds of JMC 7 is out, that will probably be the easiest way to get started for people who don’t want to change stuff. This blog, however, will be for the ones of you who would like to build JMC from source.
First step is to get Mercurial, the SCM used for OpenJDK. JMC (being an OpenJDK project) is available through a Mercurial repository. Installing Mercurial is different for different platforms:
Mac OS X
Easiest is to install through Homebrew:
brew install mercurial
That said, dmg packages can also be downloaded from here: https://www.mercurial-scm.org/wiki/Download.
Go to https://www.mercurial-scm.org/wiki/Download. Download the InnoSetup based installer and run it. Ensure that the “add to path” checkbox is checked. Verify that the install went fine by opening a command prompt and typing hg and enter. A list of the available commands should be printed.
For Debian based distributions, you can install using the package manager:
sudo apt-get install mercurial
That said, you can also get rpms and other installation packages from here: https://www.mercurial-scm.org/wiki/Download.
Cloning the Source
Once Mercurial is installed properly, getting the source is as easy as cloning the jmc repo. First change into the directory where you want to check out jmc. Then run:
hg clone http://hg.openjdk.java.net/jmc/jmc/
Since you probably have some Java experience, you probably already have Maven installed on your system. If you do not, you now need to install it. Simply follow the instructions here:
Building Mission Control
First we need to ensure that Java 8 is on our path. Some of the build components still use JDK 8, so this is important.
This will show the Java version in use. If this is not a Java 8 JDK, change your path. Once done, we are now ready to build Mission Control. Open up two terminals. Yep, two!
In the first one, go to where your cloned JMC resides and type in and execute the following commands (for Windows, replace the dash (/) with a backslash (\)):
Now, leave that terminal open with the jetty running. Do not touch.
In the second terminal, go to your cloned jmc directory. First we will need to build and install the core libraries:
Next run maven in the jmc root:
mvn clean package
JMC should now be building. The first time you build Maven will download all of the third party dependencies. This will take some time. Subsequent builds will be less painful. On my system, the first build took 6:01 min. The subsequent clean package build took 2:38.
Running Mission Control
To start your recently built Mission Control, run:
target\products\org.openjdk.jmc\win32\win32\x86_64\jmc.exe -vm %JAVA_HOME%\bin
Mac OS X
target/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK\ Mission\ Control.app/Contents/MacOS/jmc -vm $JAVA_HOME/bin
Contributing to JDK Mission Control
To contribute to JDK Mission Control, you need to have signed an Oracle Contributor Agreement. More information can be found here:
Don’t forget to join the dev list:
If there is interest, I will add a more detailed blog post on this later.
For more information on how to run tests, use APIs etc, there is a README.md file in the root of the mercurial repo. Let me know in the comments section if there is something you think I should add to this blog post and/or the README!