首先下载并解压 closure java application。下载地址: http://closure-compiler.googlecode.com/files/compiler-latest.zip在linux系统上,使用wget进行下载:(在google code中直接查询Closure Compile)#wget http://closure-compiler.googlecode.com/files/compiler-latest.zip#unzip compiler-latest.zip得到文件 compiler.jar。再确认一下java是否已经安装好了。这个compiler.jar的使用方式如下:(在命令行执行)java -jar compiler.jar --js hello.js --js_output_file hello-compiled.js或者java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js这样就把 hello.js 压缩成了 hello-compiled.js。更多信息请看帮助:java -jar compiler.jar --help