We faced a problem when running MPLAB-X with Harmony framework in a multi-user environment. We didn’t have this problem before this as there was only one person working on the PIC32 code. But we’ve added a new member this week and an issue cropped up.

It turned out that the problem was caused by a hard-coding of a temporary directory into the MPLAB-X startup script found in /usr/bin/mplab_ide

eval launchexec \
--jdkhome '"$jdkhome"' \
--clusters '"$mplab_ide_clusters"' \
-J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade \
--branding mplab \
-J-Djava.io.tmpdir=/tmp/mplab_ide \
${default_options} \
'"[email protected]"'

The java.io.tmpdir setting was hard-coded in the startup script to a static value. This caused permission problems when different users tried to run Harmony at the same time as Harmony created lots of temporary files in this directory.

One way of temporarily fixing this was to change the directory permissions in /tmp/mplab_ide but that would just end up causing more problems in the future. Therefore, we ended up fixing it by modifying the startup script to create user specific temporary directories.

eval launchexec \
--jdkhome '"$jdkhome"' \
--clusters '"$mplab_ide_clusters"' \
-J-Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade \
--branding mplab \
-J-Djava.io.tmpdir=/tmp/$USER/mplab_ide \
${default_options} \
'"[email protected]"'