Sbt doesn't load library on second runs


I have an sbt question which if answered would save me a lot of time.

Until today I ran sbt using alias sbt="sbt -Djava.library.path=/usr/local/lib"

I happened to change this today to export SBT_OPTS="-Djava.library.path=/usr/local/lib" because I updated sbt and a message about SBT_OPTS popped up so I thought this might be better.

However, before my update and still afterwards, if I load sbt and run my program by typing run, it runs fine.
But after the program returns and I type run again, it now doesn’t find the library, with the following error.

[error] (run-main-1) java.lang.UnsatisfiedLinkError: no libxxjava in java.library.path: [/usr/local/lib]

Is this some forking issue?

It means each time I want to run the program, I have to exit sbt which is time consuming.