Skip to content

Instantly share code, notes, and snippets.

@Markus-de-Koster
Last active March 7, 2022 11:40
Show Gist options
  • Save Markus-de-Koster/0d0e4ddde7d05e8b1a5440fd1809d9b9 to your computer and use it in GitHub Desktop.
Save Markus-de-Koster/0d0e4ddde7d05e8b1a5440fd1809d9b9 to your computer and use it in GitHub Desktop.
Run CPN Tools under linux using wine

Run CPN Tools 4.0.1 on Ubuntu 20.04, using wine.

Based on: http://web.archive.org/web/20180123233253/https://www.win.tue.nl/~svzelst/misc/ and https://gist.github.com/andreibosco/7cc4547771be28ad3e3db3f9a03ff9f8

  1. Download CPN Tools (for windows) from: http://cpntools.org/download
  2. Install wine (instructions on the official website: https://wiki.winehq.org/Ubuntu )
  3. Install CPN Tools using wine, i.e., wine cpntools_4.0.1.exe, make sure to include the linux simulator.
  • If this does not work due to a missing java version download OpenJDK JRE https://adoptium.net/releases.html?variant=openjdk11
  • Remember that you have to download the Windows version and install it using wine
  • To install the .msi version, use wine start $installer, replacing $installer with the actual filename
  1. Download this bash file and place it in: ~/.wine/drive_c/Program Files (x86)/CPN Tools
  2. Run the bash script: from the above mentioned directory: (chmod +x run_cpntools.sh) ./run_cpntools.sh)
  • The CPN Tools simulator will not be able to start yet; Go to: Options > Simulator Process. There, enable the "Remote" option (click on the small checkbox) and fill out the following details:
    Host : localhost
    Port : 2098
    Runtime : ./cpnsim
    Image path : cpn.ML.x86-linux
    
  1. Restart CPN Tools using the bash file
  2. If the simulator is still not working, and, in the file ~/.wine/drive_c/Program Files (x86)/CPN Tools/sim_out.log it is mentioned that java is not recognized as a program, then, run wine regedit. Within the regedit HKEY_CURRENT_USER/Environment, add a String value, named PATH with value C:\Program Files (x86)\Eclipse Adoptium\jre-11.0.14.101-hotspot\bin\ (adjust this if you used a different JRE)
  3. If the simulator log in ~/.wine/drive_c/Program Files (x86)/CPN Tools/sim_out.log mentions the following error
[<Child Process ID>]: Changing current path to ./cpnism                                                         
[<Child Process ID>]: Failed to change current dir 

you can change the Runtime option to the absolute path (i.e. /home/<yourName>/.wine/drive_c/Program Files (x86)/CPN Tools/cpnsim, pointing to the home directory through ~operator does not work for some reason)

#!/bin/bash
chmod +x ./cpnsim/run.x86-linux
chmod +x ./cpnsim/cpnmld.x86-linux
if ! pgrep -f "cpnmld.x86-linux" > /dev/null; then
echo "Starting cpnmld.x86-linux"
./cpnsim/cpnmld.x86-linux -d 2098 ./run.x86-linux ./sim_out.log &
fi
wine ./cpntools.exe
#killall cpnmld.x86-linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment