### Install Autoconf (Windows) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs Autoconf on Windows using Cygwin setup. Required for building the JDK. ```bash /setup-x86_64 -q -P autoconf ``` -------------------------------- ### Build Corretto Installer Source: https://github.com/corretto/corretto-17/blob/develop/installers/mac/pkg/README.md Run this command from the root directory of the repository to build the Corretto installer. ```bash ./gradlew :installers:mac:pkg:generateInstaller ``` -------------------------------- ### BasicToolBarSeparatorUI Methods Source: https://github.com/corretto/corretto-17/blob/develop/make/data/symbols/java.desktop-8.sym.txt Provides methods for installing defaults, painting, and getting the preferred size of toolbar separators. ```APIDOC ## BasicToolBarSeparatorUI Methods ### - **Description**: Constructs a BasicToolBarSeparatorUI. - **Signature**: `BasicToolBarSeparatorUI()` ### createUI - **Description**: Creates a new UI object for the given component. - **Signature**: `createUI(JComponent c) ComponentUI` ### installDefaults - **Description**: Installs the default properties for the separator. - **Signature**: `installDefaults(JSeparator s) void` ### paint - **Description**: Paints the toolbar separator. - **Signature**: `paint(Graphics g, JComponent c) void` ### getPreferredSize - **Description**: Gets the preferred size of the toolbar separator. - **Signature**: `getPreferredSize(JComponent c) Dimension` ``` -------------------------------- ### Install Cygwin Packages for JDK Build Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs essential packages for building the JDK on Windows using Cygwin. Ensure the path to the Cygwin setup executable is correct for your system architecture. ```bash /setup-x86_64 -q -P autoconf -P make -P unzip -P zip ``` -------------------------------- ### AWT Frame Visibility Example Source: https://github.com/corretto/corretto-17/blob/develop/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Demonstrates creating and showing a Frame, which implicitly starts AWT's event dispatch machinery and prevents premature JVM exit. ```java public static void main(String[] args) { Frame frame = new Frame(); frame.setVisible(true); } ``` -------------------------------- ### Install Autoconf (apt) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs Autoconf on Debian-based systems. Required for building the JDK. ```bash sudo apt-get install autoconf ``` -------------------------------- ### Install Autoconf (rpm) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs Autoconf on RPM-based systems. Required for building the JDK. ```bash sudo yum install autoconf ``` -------------------------------- ### Install Build Tools on Debian/Ubuntu Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs essential development tools for building on apt-based Linux distributions. ```bash sudo apt-get install build-essential ``` -------------------------------- ### Install X11 libraries on Alpine Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install necessary X11 development libraries on Alpine Linux. ```bash sudo apk add libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev ``` -------------------------------- ### Install Build Tools on Alpine Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs basic tooling and GNU versions of programs for building on Alpine Linux. ```bash sudo apk add build-base bash grep zip ``` -------------------------------- ### Install libffi Development Files (apt) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs libffi development files on Debian-based systems. Required for building the Zero version of Hotspot. ```bash sudo apt-get install libffi-dev ``` -------------------------------- ### Install X11 libraries on apt-based Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install necessary X11 development libraries on Debian/Ubuntu systems. ```bash sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev ``` -------------------------------- ### Install libffi Development Files (rpm) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs libffi development files on RPM-based systems. Required for building the Zero version of Hotspot. ```bash sudo yum install libffi-devel ``` -------------------------------- ### Connection ID Example Source: https://github.com/corretto/corretto-17/blob/develop/src/java.management/share/classes/javax/management/remote/package.html An example of a connection ID string. This format includes protocol, client address, and client ID information. ```text rmi://192.18.1.9 username 1 ``` -------------------------------- ### Display All configure Help Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Shows all available configuration options for the configure script, including general autoconf options. ```bash bash configure --help ``` -------------------------------- ### BasicToolTipUI Methods Source: https://github.com/corretto/corretto-17/blob/develop/make/data/symbols/java.desktop-8.sym.txt Provides methods for creating, installing, and uninstalling the UI for tooltips, as well as painting and determining preferred, minimum, and maximum sizes. ```APIDOC ## BasicToolTipUI ### Description Provides methods for creating, installing, and uninstalling the UI for tooltips, as well as painting and determining preferred, minimum, and maximum sizes. ### Methods #### createUI - **Signature**: `createUI(JComponent c)` - **Returns**: `ComponentUI` - **Description**: Creates a UI object for the given component. #### installUI - **Signature**: `installUI(JComponent c)` - **Description**: Installs the UI for the given component. #### uninstallUI - **Signature**: `uninstallUI(JComponent c)` - **Description**: Uninstalls the UI for the given component. #### installDefaults - **Signature**: `installDefaults(JComponent c)` - **Description**: Installs default settings for the component's UI. #### uninstallDefaults - **Signature**: `uninstallDefaults(JComponent c)` - **Description**: Uninstalls default settings for the component's UI. #### installListeners - **Signature**: `installListeners(JComponent c)` - **Description**: Installs listeners for the component's UI. #### uninstallListeners - **Signature**: `uninstallListeners(JComponent c)` - **Description**: Uninstalls listeners for the component's UI. #### paint - **Signature**: `paint(Graphics g, JComponent c)` - **Description**: Paints the tooltip UI. #### getPreferredSize - **Signature**: `getPreferredSize(JComponent c)` - **Returns**: `Dimension` - **Description**: Gets the preferred size of the tooltip. #### getMinimumSize - **Signature**: `getMinimumSize(JComponent c)` - **Returns**: `Dimension` - **Description**: Gets the minimum size of the tooltip. #### getMaximumSize - **Signature**: `getMaximumSize(JComponent c)` - **Returns**: `Dimension` - **Description**: Gets the maximum size of the tooltip. ``` -------------------------------- ### com.sun.source.util.DocSourcePositions Source: https://github.com/corretto/corretto-17/blob/develop/make/data/symbols/jdk.compiler-9.sym.txt Provides methods to get the start and end positions of DocTree elements. ```APIDOC ## DocSourcePositions ### Description Provides methods to retrieve the source code positions for DocTree elements. ### Methods - `getStartPosition(CompilationUnitTree, DocCommentTree, DocTree)`: Gets the starting position of a DocTree element. - `getEndPosition(CompilationUnitTree, DocCommentTree, DocTree)`: Gets the ending position of a DocTree element. ``` -------------------------------- ### Display Short configure Help Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Shows only JDK-specific configuration options for the configure script. ```bash bash configure --help=short ``` -------------------------------- ### Create Devkits for Multiple Targets Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md This example demonstrates creating devkits for `ppc64le-linux-gnu` and `aarch64-linux-gnu` using Fedora 21 as the base OS. The created devkits will be located in `../../build/devkit/result/`. ```bash cd make/devkit make TARGETS="ppc64le-linux-gnu aarch64-linux-gnu" BASE_OS=Fedora BASE_OS_VERSION=21 ``` ```bash ls -1 ../../build/devkit/result/ ``` -------------------------------- ### OpenJDK Build Instructions Source: https://github.com/corretto/corretto-17/blob/develop/README.md Provides instructions on how to build the OpenJDK. Refer to the HTML or Markdown files for detailed steps. ```text Welcome to the JDK! =================== For build instructions, please see either of these files: * doc/building.html (html version) * doc/building.md (markdown version) See https://openjdk.java.net/ for more information about the OpenJDK Community and the JDK. ``` -------------------------------- ### SourcePositions Interface Source: https://github.com/corretto/corretto-17/blob/develop/make/data/symbols/jdk.compiler-9.sym.txt Provides methods to get the start and end positions of a tree within a compilation unit. ```APIDOC ## SourcePositions Interface ### Description Provides methods to retrieve the starting and ending character positions of a given tree node within a compilation unit. ### Methods #### getStartPosition - **Descriptor**: (Lcom/sun/source/tree/CompilationUnitTree;Lcom/sun/source/tree/Tree;)J - **Flags**: 401 - **Description**: Returns the starting position of the given tree within the compilation unit. #### getEndPosition - **Descriptor**: (Lcom/sun/source/tree/CompilationUnitTree;Lcom/sun/source/tree/Tree;)J - **Flags**: 401 - **Description**: Returns the ending position of the given tree within the compilation unit. ``` -------------------------------- ### Create Devkits for Multiple Targets Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html This example demonstrates creating devkits for both ppc64le-linux-gnu and aarch64-linux-gnu targets using Fedora 21 as the base OS. The resulting devkits will be located in the `build/devkit/result` subdirectory. ```make make TARGETS="ppc64le-linux-gnu aarch64-linux-gnu" BASE_OS=Fedora BASE_OS_VERSION=21 ``` -------------------------------- ### Clone JDK Source Code Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Use this command to get the complete source code of the JDK repository. Ensure Git is installed. ```bash git clone https://git.openjdk.java.net/jdk/ ``` -------------------------------- ### Create and Use Relation Service Source: https://github.com/corretto/corretto-17/blob/develop/src/java.management/share/classes/javax/management/relation/package.html Demonstrates the setup and basic usage of the Relation Service, including creating relation types and instances, and querying relationships. ```java import java.util.*; import javax.management.*; import javax.management.relation.*; // ... MBeanServer mbs = ...; // Create the Relation Service MBean ObjectName relSvcName = new ObjectName(":type=RelationService"); RelationService relSvcObject = new RelationService(true); mbs.registerMBean(relSvcObject, relSvcName); // Create an MBean proxy for easier access to the Relation Service RelationServiceMBean relSvc = MBeanServerInvocationHandler.newProxyInstance(mbs, relSvcName, RelationServiceMBean.class, false); // Define the DependsOn relation type RoleInfo[] dependsOnRoles = { new RoleInfo("dependent", Module.class.getName()), new RoleInfo("dependedOn", Module.class.getName()) }; relSvc.createRelationType("DependsOn", dependsOnRoles); // Now define a relation instance "moduleA DependsOn moduleB" ObjectName moduleA = new ObjectName(":type=Module,name=A"); ObjectName moduleB = new ObjectName(":type=Module,name=B"); Role dependent = new Role("dependent", Collections.singletonList(moduleA)); Role dependedOn = new Role("dependedOn", Collections.singletonList(moduleB)); Role[] roleArray = {dependent, dependedOn}; RoleList roles = new RoleList(Arrays.asList(roleArray)); relSvc.createRelation("A-DependsOn-B", "DependsOn", roles); // Query the Relation Service to find what modules moduleA depends on Map> dependentAMap = relSvc.findAssociatedMBeans(moduleA, "DependsOn", "dependent"); Set dependentASet = dependentAMap.keySet(); // Set of ObjectName containing moduleB ``` -------------------------------- ### javax.swing.SpinnerDateModel Source: https://github.com/corretto/corretto-17/blob/develop/make/data/symbols/java.desktop-9.sym.txt Represents a data model for a spinner that allows editing of a Date. It provides methods to set and get the start and end bounds for the date. ```APIDOC ## javax.swing.SpinnerDateModel ### Description Provides a model for a spinner that allows editing of a Date, with support for specifying start and end bounds. ### Methods - **``**: Constructs a new SpinnerDateModel. - Signature: `(java.util.Date, java.lang.Comparable, java.lang.Comparable, int)` - **`setStart`**: Sets the start boundary for the date. - Signature: `(java.lang.Comparable)` - **`getStart`**: Gets the start boundary for the date. - Signature: `()java.lang.Comparable` - **`setEnd`**: Sets the end boundary for the date. - Signature: `(java.lang.Comparable)` - **`getEnd`**: Gets the end boundary for the date. - Signature: `()java.lang.Comparable` ``` -------------------------------- ### Run Notepad Demo Source: https://github.com/corretto/corretto-17/blob/develop/src/demo/share/jfc/Notepad/README.txt Execute the Notepad demo application using the Java runtime. Ensure the 'java' command is in your system's PATH. ```bash java -jar Notepad.jar ``` -------------------------------- ### Applet start, stop, and run methods using Thread.stop Source: https://github.com/corretto/corretto-17/blob/develop/src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html This example demonstrates the older, unsafe way of stopping a thread using Thread.stop within an applet's lifecycle methods. ```java private Thread blinker; public void start() { blinker = new Thread(this); blinker.start(); } public void stop() { blinker.stop(); // UNSAFE! } public void run() { while (true) { try { Thread.sleep(interval); } catch (InterruptedException e){ } repaint(); } } ``` -------------------------------- ### Install Autoconf (apk) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs Autoconf on Alpine Linux. Required for building the JDK. ```bash sudo apk add autoconf ``` -------------------------------- ### Run Configure Script Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Execute the configure script to set up the build environment. This script checks for dependencies and prepares the build configuration. If it fails, follow the suggested instructions to resolve missing dependencies. ```bash bash configure ``` -------------------------------- ### Setup Bash Completion for Configure Script Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md This script helps bash completion understand the `configure` script by creating a helper that executes the actual configure script. Ensure the helper is placed in your PATH. ```bash cat << EOT > /tmp/configure #!/bin/bash if [ $(pwd) = $(cd $(dirname $0); pwd) ] ; then echo >&2 "Abort: Trying to call configure helper recursively" exit 1 fi bash $PWD/configure "$@" EOT chmod +x /tmp/configure sudo mv /tmp/configure /usr/local/bin ``` -------------------------------- ### Basic configure Script Invocation Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Creates a build configuration directory and sets up the build environment. The output directory name depends on your specific configuration. ```bash bash configure [options] ``` -------------------------------- ### Install FreeType on macOS Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install FreeType using Homebrew on macOS. ```bash brew install freetype ``` -------------------------------- ### Install Autoconf (macOS) Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs Autoconf on macOS using Homebrew. Required for building the JDK. ```bash brew install autoconf ``` -------------------------------- ### Build JDK Images with Make Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Use the 'make images' command to build the JDK images. Ensure you have the necessary dependencies installed. ```bash make images ``` -------------------------------- ### Configure for 32-bit Windows Build with FreeType2 Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Creates a 32-bit build for Windows, specifying the path to FreeType2. Requires a Cygwin environment. ```bash bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32 ``` -------------------------------- ### Install Cross-Compiler for AArch64 Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs the necessary cross-compiler toolchain for building AArch64 binaries on a Debian/Ubuntu system. ```bash apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu ``` -------------------------------- ### View J2D Demo Command Line Options Source: https://github.com/corretto/corretto-17/blob/develop/src/demo/share/jfc/J2Ddemo/README.txt Display all available command-line options for customizing J2Ddemo runs. ```bash java -jar J2Ddemo.jar -help ``` -------------------------------- ### Install CUPS on Alpine Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install CUPS development files on Alpine Linux. ```bash sudo apk add cups-dev ``` -------------------------------- ### Build Replay JARs with SA Source: https://github.com/corretto/corretto-17/blob/develop/src/jdk.hotspot.agent/doc/cireplay.html Use the `buildreplayjars` command in SA to create necessary JAR files for the replay process. Specify 'all', 'boot', or 'app' to control which JARs are generated. ```shell hsdb> buildreplayjars [all | boot | app] ``` -------------------------------- ### Install CUPS on rpm-based Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install CUPS development files on Fedora/CentOS/RHEL systems. ```bash sudo yum install cups-devel ``` -------------------------------- ### Make Build with Info Log Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Run the make build with LOG=info to obtain a detailed build time summary at the end of the process. This helps in analyzing build performance. ```bash make LOG=info ``` -------------------------------- ### Basic Compile Framework Usage Source: https://github.com/corretto/corretto-17/blob/develop/test/hotspot/jtreg/compiler/lib/compile_framework/README.md This snippet demonstrates the fundamental steps of using the Compile Framework: creating an instance, adding Java source code, compiling it, and invoking a method on the compiled class. Use this for simple, self-contained compilation tasks. ```java // Create a new CompileFramework instance. CompileFramework compileFramework = new CompileFramework(); // Add a java source file. compileFramework.addJavaSourceCode("XYZ", ""); // Compile the source file. compileFramework.compile(); // Object returnValue = XYZ.test(5); Object returnValue = compileFramework.invoke("XYZ", "test", new Object[] {5}); ``` -------------------------------- ### Install CUPS on apt-based Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install CUPS development files on Debian/Ubuntu systems. ```bash sudo apt-get install libcups2-dev ``` -------------------------------- ### Run J2D Demo Source: https://github.com/corretto/corretto-17/blob/develop/src/demo/share/jfc/J2Ddemo/README.txt Execute the J2Ddemo application from the command line. ```bash java -jar J2Ddemo.jar ``` -------------------------------- ### Install FreeType on Alpine Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install FreeType development files on Alpine Linux. ```bash sudo apk add freetype-dev ``` -------------------------------- ### Install FreeType on rpm-based Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install FreeType development files on Fedora/CentOS/RHEL systems. ```bash sudo yum install freetype-devel ``` -------------------------------- ### Run TransparentRuler Demo Source: https://github.com/corretto/corretto-17/blob/develop/src/demo/share/jfc/TransparentRuler/README.txt Execute this command in your terminal to launch the demo. Ensure the 'java' command is in your system's PATH. ```bash java -jar TransparentRuler.jar ``` -------------------------------- ### Select Build Configuration with SPEC Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Specify a build configuration by pointing to its 'spec.gmk' file using the SPEC make control variable. This is an advanced usage and not recommended for general users. ```makefile make SPEC=$BUILD/spec.gmk ``` -------------------------------- ### Install FreeType on apt-based Linux Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Use this command to install FreeType development files on Debian/Ubuntu systems. ```bash sudo apt-get install libfreetype6-dev ``` -------------------------------- ### Run Java Version Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.md Verify the newly built JDK by checking its version. Ensure the JDK's bin directory is in your PATH or specify the full path to the java executable. ```bash images/jdk/bin/java -version ``` -------------------------------- ### RSAES-OAEP Encryption Example 10.6 Source: https://github.com/corretto/corretto-17/blob/develop/test/jdk/com/sun/crypto/provider/Cipher/RSA/oaep-vect.txt This snippet shows the final RSAES-OAEP encryption example with its message and seed. ```text # Message to be encrypted: ea f1 a7 3a 1b 0c 46 09 53 7d e6 9c d9 22 8b bc fb 9a 8c a8 c6 c3 ef af 05 6f e4 a7 f4 63 4e d0 0b 7c 39 ec 69 22 d7 b8 ea 2c 04 eb ac # Seed: 9f 47 dd f4 2e 97 ee a8 56 a9 bd bc 71 4e b3 ac 22 f6 eb 32 ``` -------------------------------- ### Lookup Operation Example Source: https://github.com/corretto/corretto-17/blob/develop/src/java.naming/share/classes/javax/naming/package.html Demonstrates how to look up an object (e.g., a Printer) from a context and use it. This is a common operation for retrieving resources by name. ```java Printer printer = (Printer)ctx.lookup("treekiller"); printer.print(report); ``` -------------------------------- ### Configure and Build OpenJDK with Devkit Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Use this command to configure and build OpenJDK for a target platform using a pre-existing devkit. Ensure `` points to the correct devkit. ```bash bash configure --with-devkit= --openjdk-target=ppc64-linux-gnu && make ``` -------------------------------- ### Install Build Tools on Fedora/Red Hat Source: https://github.com/corretto/corretto-17/blob/develop/doc/building.html Installs essential development tools for building on rpm-based Linux distributions. ```bash sudo yum groupinstall "Development Tools" ``` -------------------------------- ### jdeprscan Example Output Snippet Source: https://github.com/corretto/corretto-17/blob/develop/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/readme.md An example of the output format produced by jdeprscan when reporting the usage of deprecated methods. ```text // java.lang.Boolean @Deprecated(since="9") public Boolean(boolean value) // java.lang.Thread @Deprecated(since="1.5", forRemoval=true) public void destroy() ```