Skip to content
This repository has been archived by the owner on Jan 23, 2018. It is now read-only.

I found out the reason why CDT 1.4.0a startup failed on Windows 7 but encountered yet another problem #86

Open
philos99 opened this issue Dec 7, 2011 · 0 comments
Labels

Comments

@philos99
Copy link

philos99 commented Dec 7, 2011

First of all, the following is my clojure programming environment on Windows 7.

C:\work\lab\myproject> lein version
Leiningen 1.6.3-SNAPSHOT on Java 1.7.0_01 Java HotSpot(TM) Client VM

My first project.clj is as follows.

(defproject myproject "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.3.0"]]
  :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]
                     [clojure-source "1.3.0-alpha5"]]
  :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"]
  :extra-classpath-dirs ["C:\\usr\\lang\\java\\jdk\\lib\\tools.jar"])

I typed the next command on the console.

C:\work\lab\myproject> lein swank
Listening for transport dt_socket at address: 50649
Connection opened on localhost port 4005.

The following is the content of src/myproject/core.clj.

;; src/myproject/core.clj
(ns myproject.core)

(defn my-add [a b]
  (+ a b))

After typing M-x slime-connect on Emacs, I tried the following.

user> (use 'myproject.core)
nil

user> (my-add 10 20)
30

user> (use 'swank.cdt)
warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.
CDT  1.4.0a startup failed:  #<RuntimeException java.lang.RuntimeException: java.io.IOException: no providers installed>
nil

At this time, my console shows the next message.

C:\work\lab\myproject> lein swank
Listening for transport dt_socket at address: 50649
Connection opened on localhost port 4005.
java.util.ServiceConfigurationError: com.sun.tools.attach.spi.AttachProvider: Pr
ovider sun.tools.attach.WindowsAttachProvider could not be instantiated: java.la
ng.UnsatisfiedLinkError: no attach in java.library.path

I searched the Internet for the solution hint and found the clue on the site
http://www.coderanch.com/t/377174/java/java/java-library-path

So I inserted the next newly added line on the project.clj, because the attach.dll was
in the folder C:\usr\lang\java\jdk\jre\bin.

(defproject myproject "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.3.0"]]
  :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]
                     [clojure-source "1.3.0-alpha5"]]
  :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"
             "-Djava.library.path=C:\\usr\\lang\\java\\jdk\\jre\\bin"] ;; <== newly added line
  :extra-classpath-dirs ["C:\\usr\\lang\\java\\jdk\\lib\\tools.jar"])

And then I restarted lein swank and had the next result.

user> (use 'myproject.core)
nil

user> (my-add 10 20)
30

user> (use 'swank.cdt)
warning: unabled to add tools.jar to classpath. This may cause CDT initialization to fail.
Clearing CDT event requests and continuing.
Swank CDT release 1.4.0a started
nil

And I confirmed on the console that swank.cdt successfully started on Windows 7.

C:\work\lab\myproject> lein swank
Listening for transport dt_socket at address: 53044
Connection opened on localhost port 4005.
CDT ready

This is the solution I found out about the Swank startup failure on Windows 7.

However I met another unexpected problem.

;; This doesn't work
user> (set-bp my-add)
No message.
  [Thrown class java.lang.NullPointerException]

user> (print-bps)
nil


;; This seems to work, but I'm not sure of it
;; because of the next message on Minibuffer.
user> (set-bp myproject.core/my-add)
nil
nil

;; The message on Minibuffer at this time
;; error in process filter: Wrong number of arguments: nil, 2

user> (print-bps)
0 myproject.core/my-add
nil

Anyway I continues my experiment as follows.

user> (my-add 20 30)

And then the next window titled sldb clojure/2 showed up.

CDT BreakpointEvent in thread Swank REPL Thread
From here you can: e/eval, v/show source, s/step, x/next, o/exit func

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: myproject.core$my_add.invoke(core.clj:3)
  1: user$eval2732.invoke(NO_SOURCE_FILE:1)
  2: clojure.lang.Compiler.eval(Compiler.java:6465)
  3: clojure.lang.Compiler.eval(Compiler.java:6431)
  4: clojure.core$eval.invoke(core.clj:2795)
  5: swank.core$eval680$fn__681.invoke(core.clj:409)
  6: clojure.lang.MultiFn.invoke(MultiFn.java:163)
  7: swank.commands.basic$eval_region.invoke(basic.clj:48)
  8: swank.commands.basic$eval_region.invoke(basic.clj:38)
  9: swank.commands.basic$eval901$listener_eval__902.invoke(basic.clj:72)
 10: clojure.lang.Var.invoke(Var.java:401)
 11: user$eval2730.invoke(NO_SOURCE_FILE)
 12: clojure.lang.Compiler.eval(Compiler.java:6465)
 13: clojure.lang.Compiler.eval(Compiler.java:6431)
 14: clojure.core$eval.invoke(core.clj:2795)
 15: swank.core$eval_in_emacs_package.invoke(core.clj:94)
 16: swank.core$eval_for_emacs.invoke(core.clj:241)
 17: clojure.lang.Var.invoke(Var.java:409)
 18: clojure.lang.AFn.applyToHelper(AFn.java:167)
 19: clojure.lang.Var.applyTo(Var.java:518)
 20: clojure.core$apply.invoke(core.clj:600)
 21: swank.core$eval_from_control.invoke(core.clj:101)
 22: swank.core$eval_loop.invoke(core.clj:106)
 23: swank.core$spawn_repl_thread$fn__639$fn__640.invoke(core.clj:320)
 24: clojure.lang.AFn.applyToHelper(AFn.java:159)
 25: clojure.lang.AFn.applyTo(AFn.java:151)
 26: clojure.core$apply.invoke(core.clj:600)
 27: swank.core$spawn_repl_thread$fn__639.doInvoke(core.clj:317)
 28: clojure.lang.RestFn.invoke(RestFn.java:397)
 29: clojure.lang.AFn.run(AFn.java:24)
 30: java.lang.Thread.run(Unknown Source)

I didn't have any choice but to do type 0 here.

And then I encountered the new empty window titled myproject%5ccore.clj, where
%5c seems to mean the ascii 0x5c backslash character code in my opinion.
And then I returned to simple-repl-clojure buffer and found the answer 50
(the result of excuting (my-add 20 30)).

and then I retried the following experiment, adding the namespace
'myproject.core' to 'my-add' function.

user> (myproject.core/my-add 20 30)

I encountered again the next sldb clojure/3 window which had

CDT BreakpointEvent in thread Swank REPL Thread
From here you can: e/eval, v/show source, s/step, x/next, o/exit func

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: myproject.core$my_add.invoke(core.clj:3)
  1: user$eval2744.invoke(NO_SOURCE_FILE:1)
  2: clojure.lang.Compiler.eval(Compiler.java:6465)
  3: clojure.lang.Compiler.eval(Compiler.java:6431)
  4: clojure.core$eval.invoke(core.clj:2795)
  5: swank.core$eval680$fn__681.invoke(core.clj:409)
  6: clojure.lang.MultiFn.invoke(MultiFn.java:163)
  7: swank.commands.basic$eval_region.invoke(basic.clj:48)
  8: swank.commands.basic$eval_region.invoke(basic.clj:38)
  9: swank.commands.basic$eval901$listener_eval__902.invoke(basic.clj:72)
 10: clojure.lang.Var.invoke(Var.java:401)
 11: user$eval2742.invoke(NO_SOURCE_FILE)
 12: clojure.lang.Compiler.eval(Compiler.java:6465)
 13: clojure.lang.Compiler.eval(Compiler.java:6431)
 14: clojure.core$eval.invoke(core.clj:2795)
 15: swank.core$eval_in_emacs_package.invoke(core.clj:94)
 16: swank.core$eval_for_emacs.invoke(core.clj:241)
 17: clojure.lang.Var.invoke(Var.java:409)
 18: clojure.lang.AFn.applyToHelper(AFn.java:167)
 19: clojure.lang.Var.applyTo(Var.java:518)
 20: clojure.core$apply.invoke(core.clj:600)
 21: swank.core$eval_from_control.invoke(core.clj:101)
 22: swank.core$eval_loop.invoke(core.clj:106)
 23: swank.core$spawn_repl_thread$fn__639$fn__640.invoke(core.clj:320)
 24: clojure.lang.AFn.applyToHelper(AFn.java:159)
 25: clojure.lang.AFn.applyTo(AFn.java:151)
 26: clojure.core$apply.invoke(core.clj:600)
 27: swank.core$spawn_repl_thread$fn__639.doInvoke(core.clj:317)
 28: clojure.lang.RestFn.invoke(RestFn.java:397)
 29: clojure.lang.AFn.run(AFn.java:24)
 30: java.lang.Thread.run(Unknown Source)

And the next message on the Minibuffer showed up.

File C:/work/lab/myproject/src/myproject%5ccore.clj no longer exists!

To sum up, in my guess, the first problem is that swank-clojure doesn't process
the backslash character code properly.

And the second problem is that swank-cdt doesn't recognize src/myproject/core.clj
unless I specifiy it explicitly, as in the case (myproject.core/my-add 20 30) in my experiment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant