From another learner --really a java-ignoramus-extremus:
Would someone take pity and give a clojure recipe for using
commons.io.FileUtils.copyFile to copy "fileA" to "fileB" (say).
I have found and installed commons.io via package manager and it ended
up in /usr/share/java/commons-io.jar. Was that the right thing to do?
The rest of java seems to live under /usr/java/jdk1.6.0_10/
I am starting REPL via the rlwrap script posted on the wiki.
My first stumbling block seems to be how to do the import! :-(
TIA,
..jim
Yes, thanks very much Stuart. I had tried just about everything you said
except I wasn't prepending the "org.apache." in the import. <sigh>
==> FYI add_classpath works fine.
As a curiosity, I notice that (System/getProperty "java.class.path")
does not reflect any change after add-classpath.
==> I wonder if this is as it should be? And if so, I am left wondering
how to determine the "real" value of the current classpath.
For possible benefit to other newbies, this is what I came up with for
inclusion in (say) user.clj. (criticism welcome)
- - -
;;Copy file (using pathnames) using the Apache.org commons library
(add-classpath "file:///usr/share/java/commons-io.jar")
(import '(org.apache.commons.io FileUtils))
(defn copyfile-byname [src cpy]
(FileUtils/copyFile (java.io.File. src) (java.io.File. cpy)))
- - -
Regards,
..jim
Apparently "such use of add-classpath is discouraged":
--
Michael Wood <esio...@gmail.com>
ok... thanks.
I /am/ left believing I'll remain confused about this part of java for a
while longer. :-(
I was hoping that I could somehow tell java to look in (eg) the
/usr/share/java tree when trying to resolve imports.
If someone can direct me where I can educate myself about this aspect of
java, libs, and jar-files a bit more, that would be appreciated.
Otherwise I don't mean to hijack this list for general java questions.
Regards,
..jim