Skip to content

Java classes can't be resolved - not a relative path - IllegalArgumentException #2624

@loeschzwerg

Description

@loeschzwerg

I get this error, whenever I try to start a Clojure REPL* within cursive.

  • (nrepl, run with leiningen, working directory: full path to project)
java.lang.IllegalArgumentException: /export/src/xxx/file/util/MyException.class is not a relative path
	at clojure.java.io$as_relative_path.invokeStatic(io.clj:414)
	at clojure.java.io$file.invokeStatic(io.clj:426)
	at clojure.java.io$file.invoke(io.clj:418)
	at cursive.leiningen.task$prep_hook$fn__2418$fn__2425.invoke(task.clj:40)

I added a custom Exception to use as a break exception.

package xxx.file.util;

public class MyException extends Exception {
}
export
+ src.xxx
+- file
+-- util
+--- MyException.class
+-- writer.clj
+- ...
+ project.clj

adjusted the project.clj

  :java-source-paths [ "src/de/xxx/file/util"]

and added the Exception to be used

(ns xxx.file.writer
  (:require [...]
  (:import xxx.file.util.MyException)))

(loop [[item port] (alts! [data-chan timeout-chan ex-chan])]
        (cond
          (= port data-chan)    (when item
                                  (item-fn item)
                                  (recur (alts! [data-chan timeout-chan ex-chan])))
          (= port timeout-chan) (throw (TimeoutException.))
          (= port ex-chan)      (throw (MyException.)))))

1f9fc63a-5764-11ec-9800-1831bf08bfc7 (reference for stack-trace report)

When I try to do lein repl in the CLI it works just fine.
Currently I use "Run with IntelliJ project Classpath" instead of "Run with Leiningen", which also works.

Could you kindly advise how to resolve this error or classify it as a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions