I had exactly that problem when using an old version of JDAF. The newer version makes it configurable.
to get around the problem i used AspectJ like this:
@Aspect
public class SystemExitEvader {
@Pointcut("call(* java.lang.System.exit(..)) && args(status)")
public void systemExitCall(int status){}
@Around("systemExitCall(status)")
public void doNothing(ProceedingJoinPoint thisJoinPoint, int status){
System.out.println("Call to System.exit() attempted");
// note: there is no call to proceed()
}
}
Well, I dont know if you could. but unless anyone else chimes in with another solution... there's no problem using clojure and java together in a lein project.
And just to check ... this system/exit call is library code you have no control over right? I mean, if not of course you can stick a when block around it looking for a system property set from the repl or something along those lines.
In my application I have a quit button which does:
(System/exit 0)But when I used 'lein repl' I do not want to exit, but just close the frame. Can this be done?
On Feb 27, 2015, at 12:09 AM, Cecil Westerhof <cldwes...@gmail.com> wrote:In my application I have a quit button which does:
(System/exit 0)But when I used 'lein repl' I do not want to exit, but just close the frame. Can this be done?Here’s how we do it. Add the following to project.clj::profiles {:repl {:jvm-opts ~(conj (jvm-opts) "-Dlein.profile.repl=true")}}
Caused by: java.lang.RuntimeException: Unable to resolve symbol: jvm-opts in this context, compiling:(/home/cecil/Clojure/quotes/project.clj:9:38)
On Feb 27, 2015, at 6:56 AM, Cecil Westerhof <cldwes...@gmail.com> wrote:Caused by: java.lang.RuntimeException: Unable to resolve symbol: jvm-opts in this context, compiling:(/home/cecil/Clojure/quotes/project.clj:9:38)Right, as I said:
"jvm-opts is a function in project.clj that returns the default JVM options — we do different things on different platforms — it returns a vector of JVM options. So :jvm-opts ["-Dlein.profile.repl=true"] might be sufficient for you."