This is really "just" a +1 for using Leiningen.

TL;DR: Just start with `lein new app hello-world` and get an editor 
integrated with your REPL quickly. Come back to these sorts of things 
later, if/when you still think they're worthwhile.

I came to clojure from the python/c++ world, with just enough common lisp 
to know that I really wanted to understand how this all works.

And just enough java to know that I never wanted to learn about CLASSPATH.

This sort of thing kept me from giving clojure a serious chance for at 
least a year or two. The only reason I kept trying was that I kept hearing 
such good things about it from people who seemed like they'd put in enough 
time and effort to have good, solid opinions.

Leiningen was the secret sauce that finally let me quit worrying about the 
java nonsense that I just didn't want to care about so I could start poking 
away at the language to see if I could find ways to bend it to my will.

Both of those attitudes were wrong. The "java nonsense" is one (many?) of 
the best parts, though it took me a long time to realize that (and lots of 
it *are* hard to swallow). And it was more a matter of me learning a better 
way to program than any amount of getting clojure to work the way I 
wanted/expected.

I think it's a little sad that setting up a toy project is this painful. 
Then again, clojure really isn't *for* toy projects.

Regards,
James

On Friday, October 13, 2017 at 4:06:12 PM UTC-5, Damien Mattei wrote:
>
> @james
> i also try to set the CLASSPATH at src but it does noot work, i will try 
> Leiningen monday
> Regards,
>
> Damien
>
> On Friday, October 13, 2017 at 9:12:55 PM UTC+2, James Reeves wrote:
>>
>> The docstring for compile 
>> <https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/compile>
>>  
>> says that "The source for the lib must be in a proper
>> classpath-relative directory", so unfortunately you can't just create the 
>> namespace in the REPL and compile it from there. The tutorial on the 
>> Clojure site doesn't make that as clear as it could be.
>>
>> In your revised example, you're setting the classpath incorrectly. The 
>> classpath should contain the root of your file tree. For example, if you 
>> have the file path "src/clojure/examples/hello.clj", then the classpath 
>> should be set to "src".
>>
>> I'm not sure how the "clojure" script you're running works, but you might 
>> find Leiningen to be a better starting point. In Clojure 1.9, an official 
>> "clj" script is going to be introduced, which might make this process 
>> easier. Until then, Leiningen is probably the safer bet.
>>
>> On 13 October 2017 at 18:13, Damien Mattei <damien...@gmail.com> wrote:
>>
>>> i did not have , i just follow the tutorial:
>>> https://clojure.org/reference/compilation
>>> i made the file but still the same problem:
>>>
>>> [mattei@moita ~]$ export CLASSPATH=.:./clojure/examples
>>> [mattei@moita ~]$ clojure
>>> Clojure 1.5.1
>>> user=> (compile 'clojure.examples.hello)
>>> FileNotFoundException Could not locate 
>>> clojure/examples/hello__init.class or clojure/examples/hello.clj on 
>>> classpath:   clojure.lang.RT.load (RT.java:443)
>>> user=> ^C[mattei@moita ~]$ 
>>>
>>> [mattei@moita ~]$ cat clojure/examples/hello.clj 
>>> (ns clojure.examples.hello
>>>     (:gen-class))
>>>
>>> (defn -main
>>>   [greetee]
>>>   (println (str "Hello " greetee "!")))
>>>
>>> On Friday, October 13, 2017 at 4:48:40 PM UTC+2, James Reeves wrote:
>>>>
>>>> Maybe this is a dumb question, but do you have a file 
>>>> "clojure/examples/hello.clj" on the classpath? Since that's what the 
>>>> exception is complaining about.
>>>>
>>>> On 13 October 2017 at 15:09, Damien Mattei <damien...@gmail.com> wrote:
>>>>
>>>>> hello,
>>>>>
>>>>> i'm new to clojure, just installed it on a CentOS box,
>>>>>
>>>>> and try to compile the code below from tutorial, but it does not work, 
>>>>> i searched a lot before posting, no answer... i do not want to use 
>>>>> leiningen at this stage,later perheaps...
>>>>>
>>>>> just want to compile and run
>>>>>
>>>>> user=> (ns clojure.examples.hello
>>>>>     (:gen-class))
>>>>> nil
>>>>> clojure.examples.hello=>
>>>>> clojure.examples.hello=> (defn -main
>>>>>   [greetee]
>>>>>   (println (str "Hello " greetee "!")))
>>>>> #'clojure.examples.hello/-main
>>>>> clojure.examples.hello=> (compile 'clojure.examples.hello)
>>>>> FileNotFoundException Could not locate 
>>>>> clojure/examples/hello__init.class or clojure/examples/hello.clj on 
>>>>> classpath:   clojure.lang.RT.load (RT.java:443)
>>>>>
>>>>> help greatly appreciated (because i'm just one step to leave Clojure 
>>>>> and continue using  Kawa or Bigloo i already use or dive into ABCL , but 
>>>>> Clojure has a so good reputation, i cannot imagine being sticked here by 
>>>>> a 
>>>>> simple hello world!)
>>>>>
>>>>> damien
>>>>>
>>>>> -- 
>>>>> 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
>>>>> 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
>>>>> 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+u...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> James Reeves
>>>> booleanknot.com
>>>>
>>> -- 
>>> 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
>>> 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
>>> 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+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> James Reeves
>> booleanknot.com
>>
>

-- 
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/d/optout.

Reply via email to