no.disassemble icon indicating copy to clipboard operation
no.disassemble copied to clipboard

Fix broken jar path

Open moxaj opened this issue 8 years ago • 3 comments

The leiningen plugin writes /C:/Users/<...>/nodisassemble-0.1.3.jar into the :jvm-opts as the path to the jar. This has a leading slash, which triggers the following error:

Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file or JAR manifest missing <...>

If I setup the jvm-opts manually, without the leading slash, it seems to work.

moxaj avatar Mar 20 '16 18:03 moxaj

It sounds like a Windows-specific problem in the plugin. I'll take a look. On Mar 20, 2016 2:41 PM, "Viktor Magyari" [email protected] wrote:

The leiningen plugin writes /C:/Users/<...>/nodisassemble-0.1.3.jar into the :jvm-opts as the path to the jar. This has a leading slash, which triggers the following error:

Error occurred during initialization of VM agent library failed to init: instrument Error opening zip file or JAR manifest missing <...>

If I setup the jvm-opts manually, without the leading slash, it seems to work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/gtrak/no.disassemble/issues/14

gtrak avatar Mar 20 '16 19:03 gtrak

I've just run this on Windows (Win 10, Java 1.8.0_72, Clojure 1.8) and am getting the same behavior and result that nodisassemble is not usable on this platform for me.

kunstmusik avatar Apr 28 '16 22:04 kunstmusik

I just experimented with this change to lein-nodisassemble.plugin and it worked to get the plugin working on Windows.

(defn middleware [project]
  (let [version (get-version project)
        project (update-in project [:dependencies] conj ['nodisassemble version])
        path (-> (find-dep project) .getAbsolutePath)]
    (update-in project [:jvm-opts] conj (str "-javaagent:\"" path "\""))))

The changes are in using .getAbsolutePath and also quoting the path when assembling the javaagent string. I have not tested on other platforms, however.

kunstmusik avatar Apr 28 '16 22:04 kunstmusik