Your program invokes functions that are privileged. Thus, before you can run it, you need to add a file named lab2 to the /etc/system.conf.d/ directory to grant your program the necessary permissions.
Unless you use privileged functions that are not really necessary, the following entry is enough:
You can find this file in file lab2/conf/lab2
of the archive with Lab2 directory tree.
IMP. Remember that you must be root to write to /etc/system.conf.d/