开发者

A "hello world" using Netbeans 7.0 Enclojure 1.5

开发者 https://www.devze.com 2023-03-17 23:27 出处:网络
I just started l开发者_开发百科earning Clojure. I would like to use Netbeans but I have no idea how to setup a simple app the spits out anything. I followed the setup for the Enclojure plugin and ever

I just started l开发者_开发百科earning Clojure. I would like to use Netbeans but I have no idea how to setup a simple app the spits out anything. I followed the setup for the Enclojure plugin and everything seems good. Can anybody give a short tutorial or a hint to one on the setup.


Prerequisites:

Netbeans 7
EnClojure Plugin
Maven set up correctly
    Maven installed
    Maven Proxy setup if behind a proxy
    Netbeans: Tools > Options > Miscellaneous > Maven

Project Setup:

Menu File > New Project > Clojure > Clojure 1.2 Maven Project
Projectname= HelloWorld
Default Namespace= com.jfcorbet.helloword

Browse Project:

Projects Window > Source Packages > com.jfcorbet > helloworld.clj

You'll see:

(ns com.jfcorbet.helloworld
    ;(:import )
    ;(:require )
)

Add:

(defn hello
"Prints Hello and name parameter"
     [name]
     (println (str "Hello " name)))

(hello "Jean-François")

and save.

Now Rightclick your project and choose "Build with Dependencies", this should make Maven download the clojure and contrib libraries, and take care of the dependencies.

then

Rightclick your project and choose "Start Project REPL"
    Project window > helloworld.clj > RMB > choose "Load Sources in Repl"
    or select source text and RMB > "Evaluate Expr in REPL"
0

精彩评论

暂无评论...
验证码 换一张
取 消