Getting Clojure running on windows
Getting Clojure running on windows
1 准备环境
1.1 下载相关文件
1.1.1 下载clojure
$ wget --no-check-certificate http://github.com/downloads/clojure/clojure/clojure-1.2.1.zip
1.1.2 下载jline,用于Clojure REPL(交互模式)下支持line editing and history
$ wget http://downloads.sourceforge.net/project/jline/jline/1.0/jline-1.0.zip
1.1.3 安装Gow工具包 (可选)
1.2 配置
$ unzip clojure-1.2.1.zip
$ unzip jline-1.0.zip
$ cd clojure-1.2.1 && mkdir bin
$ cp ../jline-1.0/jline-1.0.jar bin
# 启动脚本
$ nodepad bin/clojure.bat
@echo off
rem clojure lancher shell for windows
set SCRIPT_DIR=%~dp0
rem set "CURRENT_DIR=%cd%"
if "%1" == "" goto REPL
set CP=.;%SCRIPT_DIR%/../lib/clojure.jar
java -server -Xmx792m -cp %CP% clojure.main %*
:REPL
set CP=%SCRIPT_DIR%/jline-1.0.jar;%SCRIPT_DIR%/../lib/clojure.jar
java -server -Xmx792m -cp %CP% jline.ConsoleRunner clojure.main
:END
$ pwd
F:\clojure-1.2.1
添加环境变量 CLOJURE_HOME=F:\clojure-1.2.1
修改path变量,增加 %CLOJURE_HOME%/bin;
2 验证是否安装成功
重启一个命令控制台:
2.1 REPL模式
$ clojure
Clojure 1.2.1
user=> (println "Hello,World")
Hello,World
nil
user=>
输入ctrl + d 退出
2.2 执行模式
$ echo (println "Hello, Clojure") > hello.clj
$ clojure hello.clj
Hello, Clojure
Clojure 1.2.1
user=> (System/exit 0)
$
注:启动脚本的一些参数设置目前都是硬编码,有时间参照scala的启动修改一下,支持windows和linux,并支持JVM参数设置
如 clojure -J-Xmx900m hello.clj
上一篇: 获取数组中最大值或最小值。
下一篇: 数组轮流取头或尾的最大值
推荐阅读
-
Getting Clojure running on windows
-
react native windows 启动报错处理unble to load script.Make sure you are either running a Metro server...
-
Getting Django Started on Windows 7 with Python 3 and MySQL_MySQL
-
react native windows 启动报错处理unble to load script.Make sure you are either running a Metro server...
-
Getting Django Started on Windows 7 with Python 3 and MySQL_MySQL
-
windows phonegap黑莓开发环境搭建(Getting Started with Blackberry for Phonegap in Windows
-
windows phonegap黑莓开发环境搭建(Getting Started with Blackberry for Phonegap in Windows