Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to and GraalVM slack:

Hi, i wonder how i can include a file (xsd) the native-image ? I did try -H:IncludeResources='.*/Resource.*txt$ and then try to use (io/resource "Resource.txt") but it doesn't work

ericdallo 2021-03-10T12:31:35.131600Z

I needed to included a resource file on clojure-lsp called CLOJURE_LSP_VERSION and this way works:

borkdude 2021-03-10T12:32:20.132500Z

Note that the resource pattern must be relative to your classpath, not your working dir


Wow many thanks ! and you can then use it with io/resource ?

borkdude 2021-03-10T12:38:03.132800Z



Ok many thanks can't make it work and i have almost the samle structure. I'll see with you compilation parameters if i miss something

borkdude 2021-03-10T12:40:48.133200Z

Is that dir even on your classpath? Are you able to get it in on the JVM?


It is ok now i found my error ... Many thanks to you both, for the quick help and for the faboulous tools you bring to clojure !!!!


Also i have this code that work with lein run but not once compiled as native-image (InputSource. ( (.getBytes data)))


** ERROR: **
Exception: #error {
 :cause No matching field found: getBytes for class java.lang.String
 [{:type java.lang.IllegalArgumentException
   :message No matching field found: getBytes for class java.lang.String
   :at [clojure.lang.Reflector getInstanceField 397]}]
 [[clojure.lang.Reflector getInstanceField 397]
  [clojure.lang.Reflector invokeNoArgInstanceMember 440]
  [sm_validator_cli.core$create_xml_doc invokeStatic core.clj 43]

borkdude 2021-03-10T13:41:04.134700Z

@ouvasam You need to avoid reflection warnings with (set! *warn-on-reflection* true)


Thanks but this does not work too


Typehint seems to work for this part (InputSource. ( (.getBytes ^java.lang.String data)))


now i have

(InputSource. (<|> (.getBytes data))) ** ERROR: **
Exception: #error {
 :cause org.apache.xerces.parsers.ObjectFactory
 [{:type java.lang.NoClassDefFoundError
   :message nil
   :at [org.apache.xerces.parsers.ObjectFactory class$ nil -1]}
  {:type java.lang.ClassNotFoundException
   :message org.apache.xerces.parsers.ObjectFactory
   :at [ forName 60]}]
 [[ forName 60]