Daniel. Thank you for your response - some 2 years ago, I know. So, I upgraded my Java/Clojure applet to use dtjava.embed() and a JNLP-file. And the problem got worse. Now the loader was hitting the server 10 times(!) for every Clojure-file - also the ones that were included in the JAR.
So I actually figured out how to build Clojure from source myself and fiddle with your suggestion. :-) First off, by setting cljURL to null categorically prevented Clojure from not even building. So I tried some different things, only to find out the problem lay in the very first lines of the load-function - in the calls to getResource(). This caused the JNLP2ClassLoader to first hit the server many times before getting the requested resource from the already downloaded JAR-file. The solution was as simple as to add an index to the JAR! See here: http://stackoverflow.com/questions/19187209/jnlp2classloader-findclass-requests-from-server-multiple-times-before-checking-j/19189127#19189127 As for the user.clj, I simply put an empty one into the jar at the top level. kl. 18:33:33 UTC+1 torsdag 17. november 2011 skrev Daniel Solano Gómez følgende: > > On Thu Nov 17 09:06 2011, Terje Dahl wrote: > > What is the relationship between the .clj source-file(s) and its gen- > > class compiled class-files? > > > > The reason I ask is that my app is an applet, written in Clojure > > (obviously), and compiled. > > The resulting class-files are then bundled into a jar-file, but > > without the source clj-file. > > (I don't want to incude my source-code in the deployed applet jar-file > > - for business reasons, obviously). > > > > The applet loads and runs just fine, but not before requesting clj- > > files from the server. > > In my server log files I see failed requests for "user.clj" and > > "applet.clj" (the file containing all my source-code). > > The applet doesn't recieve the files from the server, but runs just > > fine all the same, so obviously doesn't need them. > > > > 1. Why are these files requested in the first place, when not needed? > > By default, when loading a namespace, Clojure will try to find both the > source file and a class that loads the namespace. For example, given > the namespace "example.core", it will look for both "example/core.clj" > and "example/core__init.class". I believe the reasoning goes that if > the source file is more recent than the AOT-compiled class, it will > recompile the namespace at runtime. > > The reason why its looking for "user.clj" is that by default when > Clojure loads up it will create the "user" namespace that is used in the > REPL. > > > 2. How do I prevent these files from being requested at all? > > I don't think there is a way to do this without modifying Clojure's > code. If you're up to making your own custom build of Clojure, the > changes should be relatively simple to do. > > To prevent the lookup of the Clojure file, I think you might be able to > just change line 405 of RT.java > < > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L405 > > > so that "cljURL" is simply set to null. I haven't tested it, but I > think it should work. > > To prevent the "user" namespace from being created, you should be able > to remove lines 436-452 of RT.java > < > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L436-452 > >. > I do not remember if this change will keep you from being able to > compile your applet, but I do think it'd keep the REPL from running. > > > > > (When I have 100 kids in the same school, loading my applet at the > > same time, all the extra failed and unneccessary request are unwelcome > > on an already slow school network) > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com<javascript:> > > Note that posts from new members are moderated - please be patient with > your first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.