2019-06-03 08:28:03 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta name="generator" content="pandoc" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
|
|
|
<title>IDE support in the JDK</title>
|
2022-11-21 18:32:40 +00:00
|
|
|
<style>
|
|
|
|
code{white-space: pre-wrap;}
|
|
|
|
span.smallcaps{font-variant: small-caps;}
|
|
|
|
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
|
|
|
div.column{flex: auto; overflow-x: auto;}
|
|
|
|
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
|
|
|
ul.task-list{list-style: none;}
|
|
|
|
ul.task-list li input[type="checkbox"] {
|
|
|
|
width: 0.8em;
|
|
|
|
margin: 0 0.8em 0.2em -1.6em;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
|
2019-06-03 08:28:03 +00:00
|
|
|
</style>
|
|
|
|
<link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css" />
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
|
|
|
<![endif]-->
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header id="title-block-header">
|
|
|
|
<h1 class="title">IDE support in the JDK</h1>
|
|
|
|
</header>
|
2022-11-21 18:32:40 +00:00
|
|
|
<nav id="TOC" role="doc-toc">
|
2019-06-03 08:28:03 +00:00
|
|
|
<ul>
|
2022-11-21 18:32:40 +00:00
|
|
|
<li><a href="#introduction" id="toc-introduction">Introduction</a>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#ide-support-for-native-code"
|
|
|
|
id="toc-ide-support-for-native-code">IDE support for native
|
|
|
|
code</a></li>
|
|
|
|
<li><a href="#ide-support-for-java-code"
|
|
|
|
id="toc-ide-support-for-java-code">IDE support for Java code</a></li>
|
2019-06-03 08:28:03 +00:00
|
|
|
</ul></li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
<h2 id="introduction">Introduction</h2>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>When you are familiar with building and testing the JDK, you may want
|
|
|
|
to configure an IDE to work with the source code. The instructions
|
|
|
|
differ a bit depending on whether you are interested in working with the
|
|
|
|
native (C/C++) or the Java code.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<h3 id="ide-support-for-native-code">IDE support for native code</h3>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>There are a few ways to generate IDE configuration for the native
|
|
|
|
sources, depending on which IDE to use.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<h4 id="visual-studio-code">Visual Studio Code</h4>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>The make system can generate a <a
|
|
|
|
href="https://code.visualstudio.com">Visual Studio Code</a> workspace
|
|
|
|
that has C/C++ source indexing configured correctly, as well as launcher
|
|
|
|
targets for tests and the Java launcher. After configuring, a workspace
|
|
|
|
for the configuration can be generated using:</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<pre class="shell"><code>make vscode-project</code></pre>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>This creates a file called <code>jdk.code-workspace</code> in the
|
|
|
|
build output folder. The full location will be printed after the
|
|
|
|
workspace has been generated. To use it, choose
|
|
|
|
<code>File -> Open Workspace...</code> in Visual Studio Code.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<h5 id="alternative-indexers">Alternative indexers</h5>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>The main <code>vscode-project</code> target configures the default
|
|
|
|
C++ support in Visual Studio Code. There are also other source indexers
|
|
|
|
that can be installed, that may provide additional features. It's
|
|
|
|
currently possible to generate configuration for two such indexers, <a
|
|
|
|
href="https://clang.llvm.org/extra/clangd/">clangd</a> and <a
|
|
|
|
href="https://github.com/Andersbakken/rtags">rtags</a>. These can be
|
|
|
|
configured by appending the name of the indexer to the make target, such
|
|
|
|
as:</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<pre class="shell"><code>make vscode-project-clangd</code></pre>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>Additional instructions for configuring the given indexer will be
|
|
|
|
displayed after the workspace has been generated.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<h4 id="visual-studio">Visual Studio</h4>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>The make system can generate a Visual Studio project for the Hotspot
|
|
|
|
native source. After configuring, the project is generated using:</p>
|
2022-01-13 16:17:50 +00:00
|
|
|
<pre class="shell"><code>make hotspot-ide-project</code></pre>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>This creates a file named <code>jvm.vcxproj</code> in
|
|
|
|
<code>ide\hotspot-visualstudio</code> subfolder of the build output
|
|
|
|
folder. The file can be opened in Visual Studio via
|
|
|
|
<code>File -> Open -> Project/Solution</code>.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<h4 id="compilation-database">Compilation Database</h4>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>The make system can generate generic native code indexing support in
|
|
|
|
the form of a <a
|
|
|
|
href="https://clang.llvm.org/docs/JSONCompilationDatabase.html">Compilation
|
|
|
|
Database</a> that can be used by many different IDEs and source code
|
|
|
|
indexers.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<pre class="shell"><code>make compile-commands</code></pre>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>It's also possible to generate the Compilation Database for the
|
|
|
|
HotSpot source code only, which is a bit faster as it includes less
|
|
|
|
information.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
<pre class="shell"><code>make compile-commands-hotspot</code></pre>
|
|
|
|
<h3 id="ide-support-for-java-code">IDE support for Java code</h3>
|
2022-01-13 16:17:50 +00:00
|
|
|
<h4 id="intellij-idea">IntelliJ IDEA</h4>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>The JDK project has a script that can be used for indexing the
|
|
|
|
project with IntelliJ. After configuring and building the JDK, an
|
|
|
|
IntelliJ workspace can be generated by running the following command in
|
|
|
|
the top-level folder of the cloned repository:</p>
|
2022-01-13 16:17:50 +00:00
|
|
|
<pre class="shell"><code>bash bin/idea.sh</code></pre>
|
2022-11-21 18:32:40 +00:00
|
|
|
<p>To use it, choose <code>File -> Open...</code> in IntelliJ and
|
|
|
|
select the folder where you ran the above script.</p>
|
|
|
|
<p>Next, configure the project SDK in IntelliJ. Open
|
|
|
|
<code>File -> Project Structure -> Project</code> and select
|
|
|
|
<code>build/<config>/images/jdk</code> as the SDK to use.</p>
|
|
|
|
<p>In order to run the tests from the IDE, you can use the JTReg plugin.
|
|
|
|
Instructions for building and using the plugin can be found <a
|
|
|
|
href="https://github.com/openjdk/jtreg/tree/master/plugins/idea">here</a>.</p>
|
2019-06-03 08:28:03 +00:00
|
|
|
</body>
|
|
|
|
</html>
|