-
Notifications
You must be signed in to change notification settings - Fork 73
Setting up Eclipse
It should be relatively straightforward to set up Eclipse to work with the PRISM code base. Proceed as follows:
-
If you haven't done so already, get the PRISM source code. The easiest way to do this is to clone the main repo: https://github.com/prismmodelchecker/prism
-
Build PRISM from the command line before you import into Eclipse. This is to get the C/C++ code built, which won't be compiled by Eclipse. This should just require you to
cd
into theprism
subdirectory and runmake
. See the installation instructions if you have problems. -
Now, create a new Java project in Eclipse, choosing to use the existing PRISM directory rather than creating a new one (untick "Use default location" in recent versions of Eclipse). It's best to use the top-level PRISM directory (i.e., one level up from the
prism
subdirectory where you ranmake
), so that you have access to the examples repository and other useful files. These instructions assume that you do so, but it's also possible to use theprism
subdirectory if you prefer. Either way, Eclipse will read the PRISM.classpath
file, which specifies the list of required jar files (inprism/lib
), and specifies where PRISM expects compiled code to be put (inprism/classes
). -
You probably now want to re-compile PRISM's Java code using Eclipse (select "Project | Clean...") to check that everything is working and to make sure that the code gets compiled with debugging info.
-
If you want to run/debug PRISM from PRISM, there are a few more steps. Create a new "Java Application" item from the "Run Configuration" dialog and set up the following:
-
Main class: Use
prism.PrismCL
for command-line PRISM oruserinterface.GUIPrism
for the GUI. -
Dependencies (classpath): You should already have the necessary jar files set up because Eclipse reads these from the existing
.classpath
file when you create the project. If you want to run the GUI from Eclipse, you'll need to add theprism
subdirectory (from "Advanced... | Add Folders") so that icons/images are found at run-time. -
Environment: Create a new environment variable whose name is
LD_LIBRARY_PATH
(on Linux) orDYLD_LIBRARY_PATH
(on Mac) orPATH
(on Windows) and whose value isprism/lib
. Make sure "Append environment to native environment" is selected (it should be by default). This will allow Eclipse to find PRISM's native shared libraries (through JNI at runtime). This assumes that you use the top-level directory as a working directory at runtime. If you prefer to use theprism
subdirectory (either by creating the project there, or by setting the working directory for the run configuration), uselib
instead for the environment variable. -
VM arguments: It is usually not necessary, but if you see
UnsatisfiedLinkError
errors even with the above settings, try also setting "VM arguments" in the run configuration to-Djava.library.path=prism/lib
.
-
If you use Eclipse's code formatting functionality and want to write Java code that is consistent in style with PRISM, you can use our Eclipse configuration file. Go to "Java | Code Style | Formatting" in the Eclipse preferences, click "Import..." and then select the file prism-eclipse-formatter.xml
which can be found in the prism/etc
directory of PRISM source distributions.