Migrating from Adopt OpenJDK to Adoptium on Mac

Adopt OpenJDK is officially deprecated and is moved to the Eclipse Temurin project. So the Homebrew Tap for AdoptOpenJdk is also deprecated.

So we must first remove the AdoptOpenJdk tap from Homebrew:

# Uninstall the AdoptOpenJDK tap
brew untap AdoptOpenJDK/openjdk

In the next step we’ve two options. We can install the latest Temurin release or a specific one.

# Option 1: Install latest Temurin release
brew install --cask temurin

# Option 2: Install a specific Temurin release
brew tap homebrew/cask-versions
brew install --cask temurin11

You can set the JAVA_HOME variable with the following snipset in your login script:

<pre class="wp-block-syntaxhighlighter-code"># set JAVA_HOME to current Java version
export JAVA_HOME=$(/usr/libexec/java_home)

# set JAVA_HOME to a specific Java version
export JAVA_HOME=/Library/Java/JavaVirtualMachines/<version>/Contents/Home</version></pre>

Symfony 5 Skeleton Project

I’ve created a Symfony 5 skeleton project as a starting point for new projects. The tech stack for this project is based on a docker compose stack.

For the frontend i used the Bulma CSS framework and Vue.js.

The project includes:

  • MySQL 5.7 container
  • Mongo DB 4.2 container
  • PHP 7.4 container based on Ubuntu 18.04 LTS
  • Nginx container based on Ubuntu 18.04 LTS
  • PhpMyAdmin container for MySQL administration
  • Mongo Express container for Mongo DB administration
  • Portainer for Docker administration

I’ve created a Docker management script docker.sh to easely execute all Docker and build functions. The Docker stack can be configured by the .env file of the project.

So to start a new project change the hostname, IP address and container prefix in the .env file.
You can start your new docker stack by executing

./docker.sh start

This will build all local container images, bind the configured IP address to a local loopback interface and register the hostname in your /etc/hosts file.

After that you can rebuild the Symfony project by executing

./docker.sh rebuild

This will install all Symfony and NodeJS dependencies, run database migrations, install fixtures and build the frontend with Webpack Encore.

You can also execure commands in the PHP container by simple run

./docker.sh exec

To shutdown the Docker stack, unregister the hostname and remove the created loopback interface run

./docker.sh stop

For more information see the README.md file in the project: https://github.com/mgascoyne/symfony5-skeleton

Changing file line endings to LF in mixed unix/windows environments

Sometimes the developers of a project are working in different environments such as Linux, macOS and Windows. A big problem is the different handling of line endings. Windows uses CR/LF and all unix-based systems are using only LF. The code base should always use LF line endings to avoid problems.

So we must tell GIT that we want only LF line endings in our project (the following commands only work in a git repository folder):

git config core.eol lf
git config core.autocrlf input

To set this settings globally for all your git projects, add the --global paramater to the git config command.

You should also create a .gitattributes file in the repository folder and set the line endings for your file types:

# Ensure all project files using correct line endings
Vagrantfile
*.php     eol=lf
*.sh      eol=lf
*.xml     eol=lf
*.java    eol=lf

But this doesn’t affect files with incorrect line encodings already in your reporitory. To fix this, update your repository files with the following commands. Ensure you’ve no uncommited changes before using this.

git rm --cached -r .
git reset --hard
git add .
git commit -m "Normalize line endings"

Now all your files should have correct LF line endings and the changes can be pushed to your remote repository.

Change font size of NetBeans IDE controls

It’s a little bit confusing changing the font size of IDE controls and menus. The options dialog has only font size changes for the editor, not for the whole IDE. This is specially helpful on windows with scaled screen resolution on HiDPI displays.

The trick is to add an additional parameter to the VM options in the netbeans.conf configuration file. On Windows this is e.g. C:\Program Files\NetBeans 8.2\etc\netbeans.conf, on OS X /Applications/NetBeans/Netbeans 8.2.app/Contents/Resources/etc.

Add the parameter --font-size to the line starting with netbeans_default_options.

Example:
 netbeans_default_options="--font-size=14 -J-client -J-Xss2m -J-Xms32m"

Now the IDE has a font size of 14pt for the IDE.

Crystal Enterprise 10 Web Development with NetBeans

Crystal Enterprise is the leading reporting solution today. So why not use the NetBeans IDE to develop a web application for displaying and exporting reports ?

First of all we need a Crystal Enterprise Server with the latest service packs installed (i’ve some difficult problems and the solution was the latest service pack…).

Needed Libraries

We need the latest Crystal Java Libraries for development. You find this libaries in the directory «C:\Program files\Common files\Crystal Decisions\2.5\java\lib» of your server. You need all .jar files in this directory and the log4j.jar from directory «external». Copy this libraries to a local location, e.g. «c:\javalibs\crystal».

The documentation is located in file «C:\Program files\Crystal Decisions\Enterprise 10\Help\en\SDKDocs\java_docs-zip». Extract this file also to your local location, e.g. «c:\javalibs\crystal\docs».

Now we need the last thing from the Crystal Server: The Java Viewer. The viewer is located in directory «C:\Program files\Common files\Crystal Decisions\2.5\crystalviewers10». This whole directory must be available in your web application. It’s a good idea to copy this directory also to your local location, so you can copy it at any time to your projects directory.

Setup Library in NetBeans

Use the NetBeans Library Manager under «Tools -> Library Manager» to register the libraries. Name the library Crystal10-SDK.

CE10 Libraries

Switch to register tab Javadoc and add the three directories CE, RAS and Viewer from the Crystal SDK documentation.

CE10 Libraries Docs