lein repl
on a project:
user=> (javax.swing.JFrame. "My Frame")
SocketException Connection reset
java.net.SocketInputStream.read (SocketInputStream.java:209)
java.net.SocketInputStream.read (SocketInputStream.java:141)
java.io.BufferedInputStream.fill (BufferedInputStream.java:246)
java.io.BufferedInputStream.read (BufferedInputStream.java:265)
java.io.FilterInputStream.read (FilterInputStream.java:83)
java.io.PushbackInputStream.read (PushbackInputStream.java:139)
clojure.tools.nrepl.bencode/read-byte (bencode.clj:84)
clojure.tools.nrepl.bencode/read-byte (bencode.clj:-1)
clojure.tools.nrepl.bencode/read-token (bencode.clj:236)
clojure.tools.nrepl.bencode/read-token (bencode.clj:234)
clojure.tools.nrepl.bencode/read-bencode (bencode.clj:254)
clojure.tools.nrepl.bencode/read-bencode (bencode.clj:251)
Bye for now!
However on a fresh project / lein repl
without a project, it does work.
user=> (javax.swing.JFrame. "My Frame")
#object[javax.swing.JFrame 0x2ee69c3e "javax.swing.JFrame[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=My Frame,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]"]
I updated my JDK and JRE but it didn't help.
I initially noticed it while trying to use seesaw (where seesaw and Clojure were my only project dependencies). It crashed as well and then I noticed that even trying to use Swing directly causes a crash too. Removing seesaw from the dependencies made it work again. Now my project has other dependencies (none of them have to do with AWT/Swing, all of them are: clojure 1.8.0, clj-http 2.3.0, data.json 0.2.6, camel-snake-kebab 0.4.0, and clj-time 0.13.0) and it's happening again. I will try to see if I can find the minimal case.
Edit: the minimal cases is when having only Clojure and [clj-http "2.3.0"] or only Clojure and seesaw.
I also tried to make sure I'm running from the EDT (with EventQueue.invokeLater
) but it didn't help and the program crashed.
Then I tried with just AWT (java.awt.Frame.)
and I got the same crash.
Finally, fwiw, this is happening on:
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_121-b13
Windows 10 Pro x64
I now also tried to make a uberjar and it seems to work fine.
So it seems to only crash the lein repl
and CIDER's REPL (so I assume the nREPL?).
How can I diagnose and solve this?