Re: Problems starting REPL

24 views
Skip to first unread message

László Török

unread,
Feb 21, 2011, 8:30:53 AM2/21/11
to encl...@googlegroups.com
Hi,

this issue has been reported multiple times, but as it is quite sporadic, it has not been further addressed. Apart from this I really like enclojure and I beleive I found a workaround which I am going to share now.

Prequisites:
- Make sure you have Maven 2 installed.
- I use leiningen as a build tool for all of my clojure projects, make sure you have that as well.

After I set up my leiningen configuration in the project.clj file, I run:

lein pom

That generates the maven configuration file. Make sure you have the Maven plugin for Netbeans. If you do, you can open the project in Netbeans as a Maven project. Should you change the project.clj file, just rerun lein pom to regenerate the config file.

Wehn I start the project Repl (right click on the project tree root in Netbeans and select Start Repl) every now and then I get this ugly exception window saying that I have missing dependencies blabla.

I usually run lein deps followed by lein clean, and ... it magically does fix the problem. Don't ask me how.

Hope this helps.

Las

2011/2/21 JMit...@gmail.com <jmit...@gmail.com>
I'm running Netbeans 6.9.1 on Windows XP SP3 and followed the
instructions on the Enclojure site.

I cannot actually start a REPL, it couldn't find clojure-1.2.0.jar or
clojure-contrib-1.2.0.jar in .m2/org/etc...  I tried counterclockwise
+ eclipse earlier, so I just copied and renamed the .jar files from
there into the locations that Netbeans was asking.

But that still doesn't work.

Now I get  "Project REPL failed to start.  Make sure you have Clojure
and Clojure.contrib jars in your project ... etc."

I'm new to Netbeans.  I'm new to Java IDEs.  I'm a C#/Visual Studio
dev.

Why doesn't this work? What do I do?

(Besides learn Emacs...)


Thanks,
Jonathan Mitchem

--
You received this message because you are subscribed to the Google Groups "enclojure" group.
To post to this group, send email to encl...@googlegroups.com.
To unsubscribe from this group, send email to enclojure+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/enclojure?hl=en.


jmit...@gmail.com

unread,
Feb 21, 2011, 3:42:41 AM2/21/11
to enclojure

László Török

unread,
Feb 21, 2011, 12:11:34 PM2/21/11
to encl...@googlegroups.com
Hi,

I'm sorry for your annoyance, but there is a fact you need to accept, if you wanna have fun with Clojure on the JVM:

"Clojure is designed to be a hosted language, sharing the JVM type system, GC, threads etc." (http://clojure.org/jvm_hosted)
So embracing the JVM is not an implementation detail and can't save yourself the trouble to learn a bit about the Java world and it's tool ecosystem.

On Maven read: http://maven.apache.org/what-is-maven.html
On Leiningen read: https://github.com/technomancy/leiningen

There are install instructions for both, quite easy to follow. I have limited java background, still managed to consume it.

Good luck!

Las

2011/2/21 JMit...@gmail.com <jmit...@gmail.com>
This failed at home, but I tried at work today.  It "partially"
works.  I'm running Windows 7 x64 at work.

This is what I did:
1. Install JDK 1.6.14 (or whatever the latest is)
2. Install NetBeans SE 6.9.1
3. Update NetBeans AutoUpdater, restart
4. Install Enclojure, restart
5. Update everything else, restart
6. Create new Clojure 1.2 maven project
7. Added some code into defpackage.clj
8. Right click on MyClojureProject -> Start Project REPL
9. "There does not appear to be both valid clojure and clojure-contrib
jars present in the classpath." Huh? What do I do?
10. Click "Yes" to "Do you want to use the default platform
"Clojure-1.0.0"
11. Play with the REPL, load the file into the REPL, it works
12. Try (use 'clojure-contrib)
13. Get "FileNotFoundException"
14. ???

This isn't any fun.  Can't get counterclockwise/eclipse to work with
clojure-contrib.  Can't get enclojure/netbeans to work with 1.2.0 or
clojure-contrib.  Can't get la clojure/intellij to work.

What is maven? why do I need it? Likewise for leiningen?

How do I know if maven 2 is installed?

As I said, I'm a visual studio developer.  As "Apple" as it sounds,
Microsoft led me to expect the IDE to "just work".  Even using
plugins, I expect them to just work.

I'm annoyed, but still patient.  I still really really want to use
clojure with a "modern" IDE.  And NetBeans + Enclojure seems like the
nicest option of the 3.

Help please?  Thanks.


On Feb 21, 8:30 am, László Török <ltoro...@gmail.com> wrote:
> Hi,
>
> this issue has been reported multiple times, but as it is quite sporadic, it
> has not been further addressed. Apart from this I really like enclojure and
> I beleive I found a workaround which I am going to share now.
>
> Prequisites:
> - Make sure you have Maven 2 installed.
> - I use leiningen as a build tool for all of my clojure projects, make sure
> you have that as well.
>
> After I set up my leiningen configuration in the project.clj file, I run:
>
> lein pom
>
> That generates the maven configuration file. Make sure you have the Maven
> plugin for Netbeans. If you do, you can open the project in Netbeans as a
> Maven project. Should you change the project.clj file, just rerun lein pom
> to regenerate the config file.
>
> Wehn I start the project Repl (right click on the project tree root in
> Netbeans and select Start Repl) every now and then I get this ugly exception
> window saying that I have missing dependencies blabla.
>
> I usually run lein deps followed by lein clean, and ... it magically does
> fix the problem. Don't ask me how.
>
> Hope this helps.
>
> Las
>

jmit...@gmail.com

unread,
Feb 21, 2011, 12:02:22 PM2/21/11
to enclojure
> Hi,
>
> this issue has been reported multiple times, but as it is quite sporadic, it
> has not been further addressed. Apart from this I really like enclojure and
> I beleive I found a workaround which I am going to share now.
>
> Prequisites:
> - Make sure you have Maven 2 installed.
> - I use leiningen as a build tool for all of my clojure projects, make sure
> you have that as well.
>
> After I set up my leiningen configuration in the project.clj file, I run:
>
> lein pom
>
> That generates the maven configuration file. Make sure you have the Maven
> plugin for Netbeans. If you do, you can open the project in Netbeans as a
> Maven project. Should you change the project.clj file, just rerun lein pom
> to regenerate the config file.
>
> Wehn I start the project Repl (right click on the project tree root in
> Netbeans and select Start Repl) every now and then I get this ugly exception
> window saying that I have missing dependencies blabla.
>
> I usually run lein deps followed by lein clean, and ... it magically does
> fix the problem. Don't ask me how.
>
> Hope this helps.
>
> Las
>
> 2011/2/21 JMitc...@gmail.com <jmitc...@gmail.com>

jmit...@gmail.com

unread,
Feb 21, 2011, 6:55:20 PM2/21/11
to enclojure
Well, I got the latest maven and lein installed per their respective
web pages, and now I can run the REPL.

Since Enclojure creates a "Clojure 1.2 maven project", where does lein
fit into all of this?

Also, why do I get this from the project REPL? It says
clojure.contrib is in the Libraries in NetBeans.

user => (use 'clojure-contrib)
java.io.FileNotFoundException: Could not locate
clojure_contrib__init.class or clojure_contrib.clj on classpath:
(NO_SOURCE_FILE:5)

Can I use the latest Maven 3.0.2? or do I need Maven 2?

Is it there, or isn't it there? What's the difference between the
REPL and what NetBeans is telling me?

On Feb 21, 12:11 pm, László Török <ltoro...@gmail.com> wrote:
> Hi,
>
> I'm sorry for your annoyance, but there is a fact you need to accept, if you
> wanna have fun with Clojure on the JVM:
>
> "Clojure is designed to be a hosted language, sharing the JVM type system,
> GC, threads etc." (http://clojure.org/jvm_hosted)
> So embracing the JVM is not an implementation detail and can't save yourself
> the trouble to learn a bit about the Java world and it's tool ecosystem.
>
> On Maven read:http://maven.apache.org/what-is-maven.html
> On Leiningen read:https://github.com/technomancy/leiningen
>
> There are install instructions for both, quite easy to follow. I have
> limited java background, still managed to consume it.
>
> Good luck!
>
> Las
>
> 2011/2/21 JMitc...@gmail.com <jmitc...@gmail.com>

Steve

unread,
Feb 21, 2011, 7:52:40 PM2/21/11
to enclojure
On Feb 22, 10:55 am, "JMitc...@gmail.com" <jmitc...@gmail.com> wrote:
>
> Since Enclojure creates a "Clojure 1.2 maven project", where does lein
> fit into all of this?
>

Maven is a build tool that is designed to solve a bunch of problems
for Java projects, the most useful being dependency management.
Leiningen is a clojure oriented alternative to maven that has a level
of compatibility with maven.

I'd say if you are just starting out and are determined to use
Netbeans (a good choice) then forget about lein initially, it'll just
be another possible source of error/confusion. Netbeans and Enclojure
work well with maven, you can always learn lein later if you find
maven painful.

> Also, why do I get this from the project REPL?  It says
> clojure.contrib is in the Libraries in NetBeans.
>
> user => (use 'clojure-contrib)
> java.io.FileNotFoundException: Could not locate
> clojure_contrib__init.class or clojure_contrib.clj on classpath:
> (NO_SOURCE_FILE:5)
>

You need to refer to the specific library in contrib that you want to
use, you can't pull in all of contrib in one go. So if, for example,
you wanted to use the json library:

user=> (json-str {:fred "wilma" :barney "betty"})
#<CompilerException java.lang.Exception: Unable to resolve symbol:
json-str in this context (NO_SOURCE_FILE:2)>
user=> (use 'clojure.contrib.json)
nil
user=> (json-str {:fred "wilma" :barney "betty"})
"{\"fred\":\"wilma\",\"barney\":\"betty\"}"


> Can I use the latest Maven 3.0.2? or do I need Maven 2?
>

Not sure, haven't tried it with Maven 3. It works fine with Maven 2 so
I'd be inclined to try that first unless others report that they've
had no problems using it.

- Steve

Steve

unread,
Feb 21, 2011, 8:08:36 PM2/21/11
to enclojure
On Feb 22, 4:02 am, "JMitc...@gmail.com" <jmitc...@gmail.com> wrote:
> 8. Right click on MyClojureProject -> Start Project REPL
> 9. "There does not appear to be both valid clojure and clojure-contrib
> jars present in the classpath." Huh? What do I do?

I occasionally get this with Enclojure, it's worth cancelling and
trying a second time.

>
> How do I know if maven 2 is installed?
>

If you run the command "mvn" from a terminal and nothing happens you
probably don't have it installed (or it's not in your path). I *think*
that Netbeans will bundle a default version if you don't have it
installed already, not sure. If you go to Tools->Options-
>Miscellaneous is there a Maven tab? What info is there?

> As I said, I'm a visual studio developer.  As "Apple" as it sounds,
> Microsoft led me to expect the IDE to "just work".  Even using
> plugins, I expect them to just work.
>

You may have to temper that a little. I suspect there's not a
Microsoft size team of people developing it and it is a relatively
young project so it's not unreasonable for it to have a couple of
rough edges early on. I have to say though, I use it every day at work
and it works really well for me, it has allowed me to put off learning
emacs for a few more years :)

- Steve

László Török

unread,
Feb 22, 2011, 1:04:00 AM2/22/11
to encl...@googlegroups.com
Since Enclojure creates a "Clojure 1.2 maven project", where does lein
fit into all of this?

That never really worked for me. If you create you project with leiningen (run lein new [project_name], see the docs for more info), then enter the newly created directory.
You see a project.clj file. That's your leiningen config file, looks a lot friendlier than maven's pom.xml. However, you can run lein pom every time that generates a decent pom.xml.
Then you can open the project as a maven project, but you'll still have clojure available. (you can start the repl, the IDE syntax highlights clojure files etc.)
Also, most of the community libraries use leiningen and you'll find that most of the tutorials intruct you to edit your project.clj (e.g. add a dependency to a library).

So the flow:

1. Create you project with lein new [project name]
2. Enter the directory
3. Run lein deps (this get's the dependcies: initially just clojure.core and contrib)
4. Run lein pom (to generate the maven config file)
5. Fire up netbeans and Open Project and ... it should recognize you project as a maven project
6. Right click on the project tree root, select start REPL
(7. if you need to add a dependency to a new lib, just add it to your project.clj, run lein deps && lein pom)

 

Jonathan Mitchem

unread,
Feb 22, 2011, 7:01:49 PM2/22/11
to enclojure
Thanks for that. I'll give it a try.

For now, I got Eclipse/CCW working, so I at least had that to work
with yesterday. Let's see if I can get NB/enclojure so I can do some
side-by-side comparison. I've heard great things about both.

Jonathan Mitchem

unread,
Mar 6, 2011, 12:00:49 PM3/6/11
to encl...@googlegroups.com
I just wanted to say that after a lot of trial and error, and redoing it a few times, I eventually got things to work.

Don't want to give the impression that I abandoned it :-)

Just was quite a bit more difficult than I expected.  Learning a new language is difficult enough, dealing with environment setup issues where I'm almost entirely in the dark about what to do, how to fix it, or even what is what, just made it frustrating for a few days.

But I got it to work :-)


Jonathan
Reply all
Reply to author
Forward
0 new messages