> ## Documentation Index
> Fetch the complete documentation index at: https://aletyx.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Java Installation and Configuration in Aletyx Enterprise Build of Kogito and Drools 10.1.0-aletyx

> Install and configure Java 17 for Aletyx Enterprise Build of Kogito and Drools on Windows, macOS, and Linux.

<Tabs>
  <Tab title="Microsoft Windows">
    1. Install Java using Chocolatey®:

       ```powershell theme={null}
       choco install temurin17
       ```

    2. JAVA\_HOME (Run in PowerShell as Administrator):

       ```powershell theme={null}
       [Environment]::SetEnvironmentVariable(
           "JAVA_HOME",
           "C:\Program Files\Eclipse Adoptium\jdk-17.0.10.7-hotspot",
           [System.EnvironmentVariableTarget]::Machine)
       ```

    3. Add Java to PATH (Run in PowerShell as Administrator):

       ```powershell theme={null}
       [Environment]::SetEnvironmentVariable(
           "Path",
           [Environment]::GetEnvironmentVariable("Path", "Machine") + ";%JAVA_HOME%\bin",
           [System.EnvironmentVariableTarget]::Machine)
       ```

    4. Verify installation (open a new PowerShell window):

       ```powershell theme={null}
       java --version
       echo $env:JAVA_HOME
       ```
  </Tab>

  <Tab title="MacOS">
    1. Install Java:

       ```sh theme={null}
       brew install --cask temurin17
       ```

    2. Add Java environment variables to your shell configuration (for zsh):

       ```sh theme={null}
       echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.zshrc
       echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.zshrc
       ```

    3. Create a helper function to switch Java versions (optional):

       ```sh theme={null}
       echo 'function setjdk() {
           export JAVA_HOME=$(/usr/libexec/java_home -v $1)
           echo "JAVA_HOME set to $JAVA_HOME"
           java -version
       }' >> ~/.zshrc
       ```

    4. Reload shell configuration:

       ```sh theme={null}
       source ~/.zshrc
       ```

    5. Verify installation:

       ```sh theme={null}
       java --version
       echo $JAVA_HOME
       ```
  </Tab>

  <Tab title="Linux">
    1. Install Java:

       ```sh theme={null}
       sudo apt-get update
       sudo apt-get install -y temurin-17-jdk
       ```

    2. Set JAVA\_HOME and update PATH (for bash):

       ```sh theme={null}
       echo 'export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")' >> ~/.bashrc
       echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
       ```

       For zsh users:

       ```sh theme={null}
       echo 'export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")' >> ~/.zshrc
       echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.zshrc
       ```

    3. Reload shell configuration:

       ```sh theme={null}
       # For bash
       source ~/.bashrc

       # For zsh
       source ~/.zshrc
       ```

    4. Verify installation:

       ```sh theme={null}
       java --version
       echo $JAVA_HOME
       ```
  </Tab>
</Tabs>

## Troubleshooting

<Tabs>
  <Tab title="Windows">
    If Java command is not recognized after installation:

    1. Open System Properties (Win + R, type `sysdm.cpl`)
    2. Click "Environment Variables"
    3. Verify JAVA\_HOME exists and points to correct directory
    4. Verify Path includes `%JAVA_HOME%\bin`
    5. Open new command prompt to test
  </Tab>

  <Tab title="macOS">
    * "Java command is not recognized":

    ```sh theme={null}
    ls -l /Library/Java/JavaVirtualMachines/ # Verify Java installation
    ```

    * Verify JAVA\_HOME

    ```sh theme={null}
    /usr/libexec/java_home -V
    ```
  </Tab>

  <Tab title="Linux">
    * If Java command is not recognized:

    ```sh theme={null}
    # Check Java alternatives
    sudo update-alternatives --config java

    # Verify installation path
    which java
    readlink -f $(which java)
    ```
  </Tab>
</Tabs>

## Additional Configuration Tips

<Tabs>
  <Tab title="Windows">
    * Create a `.gitconfig` file in your home directory:

      ```powershell theme={null}
      notepad "$env:USERPROFILE\.gitconfig"
      ```

    * Add basic Git configuration:

      ```ini theme={null}
      [user]
          name = Your Name
          email = your.email@example.com
      [core]
          autocrlf = true
          editor = notepad
      ```
  </Tab>

  <Tab title="macOS">
    * Recommended aliases for your `.zshrc`:

      ```sh theme={null}
      # Java and Maven helpers
      echo 'alias j17="setjdk 17"' >> ~/.zshrc
      echo 'alias mvnc="mvn clean"' >> ~/.zshrc
      echo 'alias mvnp="mvn package"' >> ~/.zshrc
      echo 'alias mvni="mvn install"' >> ~/.zshrc
      ```

    * Recommended Git helpers

      ```sh theme={null}
      echo 'alias gs="git status"' >> ~/.zshrc
      echo 'alias gp="git pull"' >> ~/.zshrc
      echo 'alias gc="git commit"' >> ~/.zshrc
      ```
  </Tab>

  <Tab title="Linux">
    * Java and Maven helpers

      ```sh theme={null}
      echo 'alias j17="export JAVA_HOME=/usr/lib/jvm/temurin-17-jdk"' >> ~/.bashrc
      echo 'alias mvnc="mvn clean"' >> ~/.bashrc
      echo 'alias mvnp="mvn package"' >> ~/.bashrc
      echo 'alias mvni="mvn install"' >> ~/.bashrc
      ```

    * Git helpers

      ```sh theme={null}
      echo 'alias gs="git status"' >> ~/.bashrc
      echo 'alias gp="git pull"' >> ~/.bashrc
      echo 'alias gc="git commit"' >> ~/.bashrc
      ```
  </Tab>
</Tabs>
