Ok, first you need to add the commons-io.jar to the Java classpath. You can do this by editing the Clojure startup script. The argument to "-cp" is a colon-separated list of directories and/or JAR files to go on the classpath. So if the command line was this:
java -cp /path/to/clojure.jar clojure.lang.Repl Now it will be: java -cp /usr/share/java/commons-io.jar:/path/to/clojure.jar clojure.lang.Repl (Note: this may also be possible with the add-classpath function in Clojure, but I'm not sure if that still exists/works.) Once you've done this, restart Clojure and you should be able to (import '(org.apache.commons.io FileUtils)) Then call (FileUtils/copyFile fileA fileB) fileA and fileB should be instances of java.io.File. Hope this gets you where you need to be. :) -Stuart Sierra On Nov 24, 2:26 am, "James G. Sack (jim)" <[EMAIL PROTECTED]> wrote: > Parth Malwankar wrote: > > > On Nov 24, 12:34 am, Stuart Sierra <[EMAIL PROTECTED]> > > wrote: > >> Honestly, for this kind of low-level stuff I always use the Apache > >> Commons libraries, <http://commons.apache.org/>, esp. the Lang and IO > >> components. They've got every imaginable stream function, all > >> carefully and efficiently implemented. But if you're determined to do > >> it in Clojure, loop/recur is the way, as James demonstrated. > >> -Stuart Sierra > > > Yes. commons.io.FileUtils.copyFile is definitely a nicer way :) > > I am still learning Java (as an when I need it for Clojure). Thanks > > for the pointer. > > 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 --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---