MacOS

From BaseX Documentation
Jump to navigation Jump to search

Tested using Amazon Corretto JDK on an M1 MacBook Air

Java version when tested:

% java --version
openjdk 17.0.2 2022-01-18 LTS
OpenJDK Runtime Environment Corretto-17.0.2.8.1 (build 17.0.2+8-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.2.8.1 (build 17.0.2+8-LTS, mixed mode, sharing)

1) Create a working folder

2) Download the version of BaseX that you would like to use - download the Zip archive

3) Unzip the archive so you have the basex folder

4) Remove the .basex configuration files from the folder - to ensure that each user gets a personal file generated automatically

% rm ./basex/.basex*

5) Create a new file

basex-config.cfg

in your working folder and add the content. Remember to change the app-version (here 9.7) to your selected version

[Application]
app.classpath=$APPDIR/BaseX.jar
app.mainclass=org.basex.BaseXGUI
app.classpath=$APPDIR/lib/*
app.classpath=$APPDIR/lib/custom/*

[JavaOptions]
java-options=-Djpackage.app-version=9.7

6) If you would like to included some custom libraries in the build add them to the folder in basex/lib/custom.

7) Add the basex.icns file to your working folder. basex.icns

8) Run the command to make a disk image (.dmg) of BaseX - remember to set the app version to match your selected version, here 9.7

jpackage --input target/ \
  --input basex \
  --name "BaseX" \
  --main-jar BaseX.jar \
  --main-class org.basex.BaseXGUI \
  --type dmg \
  --icon "basex.icns" \
  --app-version "9.7" \
  --vendor "BaseX GmbH" \
  --copyright "Copyright 2023 BaseX GmbH" \
  --mac-package-name "BaseX" \
  --module-path "lib" \
  --verbose

9) A disk image will be created in your working folder. Open it and you can copy the application to your Applications folder or any chosen location

10) Optional If you want to add custom libraries later then show the package contents of the application. Replace the content of the file BaseX {version}.cfg with the original from step 5. Now you can add and remove libraries and they will be loaded/unloaded with application restart.