Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does jvm bytecode get converted to js in cljs build

Tags:

clojure

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)?

like image 483
murtaza52 Avatar asked Mar 07 '13 05:03

murtaza52


2 Answers

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.

like image 158
amalloy Avatar answered Nov 03 '22 09:11

amalloy


You cannot use Java libraries in cljs code.

like image 39
Joe Lehmann Avatar answered Nov 03 '22 09:11

Joe Lehmann