murtaza52
murtaza52

Reputation: 47441

how does jvm bytecode get converted to js in cljs build

As I understand most clojure and java libraries can be included in cljs code. How does the cljs compiler accomplish this ?

I understand that if I have a source file, the cljs compiler takes the source and outputs javascript. However how about if I am using java libraries such as joda-time for which I have included its clojure wrapper clj-time. So in this case it only has the java byte code for joda-time. So how will the cljs build tool, generate js code from the byte code of the java jar (joda-time)?

Upvotes: 5

Views: 126

Answers (2)

amalloy
amalloy

Reputation: 91837

As I understand most clojure and java libraries can be included in cljs code. How does the cljs compiler accomplish this ?

You are mistaken. Many clojure libraries can be compiled for CLJS, with only minimal changes (sometimes even none), but there is no way to use classfiles: it must be .clj source files, compiled to javascript instead of to classfiles.

Upvotes: 4

Joe Lehmann
Joe Lehmann

Reputation: 1085

You cannot use Java libraries in cljs code.

Upvotes: 2

Related Questions