1. Setup Graalvm
-
Update the file under e.g. C\Projects\IDEasy\settings and add
GRAALVM_EDITION=community |
---|
This is necessary as the community edition of graalvm is delivered with a pre-installed native image.
-
Open a command-line interface inside a devon installation e.g. C\Projects\IDEasy\workspaces\main
-
Install Graalvm using the devonfw-ide with
devon graalvm setup |
---|
When the installation is complete, the GRAALVM_HOME environment variable is automatically set to the graalvm installation path e.g. C/Projects/IDEasy/software/extra/graalvm
-
Restart your cli
-
Add $GRAALVM_HOME/bin to your PATH environment variable
Bash:
export PATH=$GRAALVM_HOME\bin:$PATH |
---|
Powershell (run as Admin):
$path = [System.Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::Machine) $newPath = "$env:GRAALVM_HOME\bin;" + $path [System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::Machine) |
---|
2. Install Dependencies
2.1 Windows: Install Visual Studio
-
Download Visual Studio from https://visualstudio.microsoft.com/downloads/
-
During the installation, make sure to include the "Desktop development with CPP" workload, as this includes the necessary C/C++ compiler
* If you already have Visual Studio installed, open the Visual Studio installer and click “modifyˮ on your existing installation. Then select the C++ workload and click on install.
2.2 Linux
Install the zlib development package on your system:
sudo apt-get update sudo apt-get install zlib1g-dev |
---|
3. Build Your Application
Run the following Maven command inside Intellij to compile your application and create an executable:
-B -ntp -Pnative -DskipTests=true package |
---|
Alternatively you can build the project using a cli:
-
Open PowerShell and check the java version with
java --version |
---|
If the java version is below 17, you need to specify a JDK with version >=17. e.g.
$env:JAVA_HOME = "C:\Projects\IDEasy\software\java\" |
---|
This command sets the JAVA_HOME variable temporarily for the session and will be re-set after you close the shell.
-
Run the following Maven command in your project directory where the pom.xml is located to compile your application and create an executable:
PATH/TO/MVN/mvn -B -ntp -Pnative -DskipTests=true package |
---|
Example:
C:\Projects\IDEasy\workspaces\main\IDEasy> C:\Projects\IDEasy\software\mvn\bin\mvn -B -ntp -Pnative -DskipTests=true package |
---|
Building the application might take up to 10 minutes depending on your machine.
4. Run your Application
An ideasy executable (e.g. ideasy.exe under windows) should be created under ../workspace/main/IDEasy/cli/target.
To run the application open a cli and pass your arguments.
Example:
C:\Projects\IDEasy\workspaces\main\IDEasy\cli\target> .\ideasy.exe mvn --version |
---|