Fork me on GitHub
#boot
<
2019-11-17
>
Rex23:11:19

Hey guys, I'm new here so please bear with me. I'm creating a boot script with the following content:

#!/usr/bin/boot

(defn -main
	[& args]
	(println "blah"))
but got this error whenever I try to run it
Boot failed to start:
java.lang.NullPointerException
        at boot.main$shebang_QMARK_.invokeStatic(main.clj:114)
        at boot.main$shebang_QMARK_.invoke(main.clj:110)
        at boot.main$_main.invokeStatic(main.clj:140)
        at boot.main$_main.invoke(main.clj:123)
        at clojure.lang.Var.invoke(Var.java:394)
        at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:154)
        at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:145)
        at boot.App.runBoot(App.java:407)
        at boot.App.main(App.java:500)
Can someone please tell me what I'm doing wrong with this? Also if I follow the instruction in https://github.com/boot-clj/boot/wiki/Scripts I still have the same issue.

Rex22:11:13

I installed Boot via Homebrew, so boot actually lives in /home/linuxbrew/.linuxbrew/bin/boot

Rex22:11:00

but that should be fine since /usr/bin/env boot finds the first boot executable in the PATH?

borkdude11:11:48

fwiw, this worked for me:

#!/usr/local/bin/boot

(defn -main
  [& args]
  (println "blah"))

Rex23:11:57

maybe my boot executable is just in the wrong place

tbl3rd16:11:56

What does which boot say?

tbl3rd16:11:30

Because from the output it looks like boot ran.

Rex00:11:36

/home/linuxbrew/.linuxbrew/bin/boot

Rex00:11:20

I'm really new into this whole thing, and googling that error didn't give me any result at all

tbl3rd15:11:30

Uninstall boot and re-install it. Then make a new empty directory, cd into it, and run boot to see what happens.

tbl3rd15:11:39

I'm guessing that (System/getProperty "boot.app.path") is null here. https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/main.clj#L113-L114

Rex22:11:20

ok so I uninstalled linuxbrew 's boot

Rex22:11:34

and downloaded the executable directly and put it on the PATH

Rex22:11:40

and now it works perfectly fine

Rex23:11:43

thanks for the suggestion tbl3rd 😄 I can start automating my stuff with clojure now to slowly convert people to clojurists 👀

tbl3rd22:11:32

Welcome to the party!