Reputation: 1267
I want to do the CS106b/CS106x course of Stanford but have problems running a C++ sample project in Qt successfully. So far it is possible for me to build the project but when I try to run it, the following error message is always shown:
***
*** STANFORD C++ LIBRARY ERROR:
*** Unable to find the file 'spl.jar' for the Stanford
*** C++ library's Java back-end process.
*** Please make sure that spl.jar is properly attached to your project.
*** If you are trying to run a stand-alone executable, place spl.jar
*** in the same directory as your executable, or set the system
*** environment variable SPL_HOME to a directory path containing spl.jar.
***
*** (I looked for it in the following directory:)
*** /
***
In fact the file 'spl.jar' is in the folder. As you can see from the screenshot.
Therefore I am assuming that, my computer is just not able to find it or also doesn't have the correct path to it, at least how I understand the last three lines in the error message?! (only a "/")
How can I set the path correctly? Does it have something to do that Java is maybe not correctly installed? I actually should have installed the latest version of Java 8 JDK.
Do you have any other ideas how to solve that?
Upvotes: 4
Views: 1033
Reputation: 1267
Okay I found a solution together with a friend. The problem was that my system environment variable SPL_HOME was empty, like already assumed from the error description.
In my case I first checked again if it's empty in the terminal with:
launchctl getenv SPL_HOME
and then assigned with this a value:
launchctl setenv SPL_HOME 'path'
'path' was here the direction to the folder where the file spl.jar was in. Credits go to this website, which basically describes it very well how to give the variable a value: https://www.schrodinger.com/kb/1842
I hope this solution helps somebody saving time of their lifes.
Edit: Oh you also wanna restart Qt and delete the build / user file of the project and then rebuild + run it.
Upvotes: 3