运行velocity的官方例子
作者:yan
1.到官網下載velocity的包,解壓某目錄。
2.cmd進入examples/app_example1 下,運行example.bat。
?
注:
1. 確保JDK環境變量OK
2.example.bat的內容如下:
?
set VELCP=.
?
for %%i in (../../bin/*.jar) do call appendVELCP %%i
for %%i in (../../bin/lib/*.jar) do call appendVELCP %%i
?
echo Using classpath: ?%VELCP%
?
java -cp %VELCP% Example example.vm
?
?
修改為:
?
?
set VELCP=.
?
for %%i in (../../velocity-1.7.jar) do call appendVELCP %%i
for %%i in (../../lib/*.jar) do call appendVELCP %%i
?
echo Using classpath: ?%VELCP%
?
java -cp %VELCP% Example example.vm
?
?
運行!這時可能還報錯,原因可能是沒有重新編譯!
解決方法:將example.bat內容的java運行指令修改為編譯指令如下:
?
?
rem?java -cp %VELCP% Example example.vm
?
?
javac -cp %VELCP% Example.java
?
運行example.bat,編譯通過后,再修改回來,再運行,OK!
?
?
另:example.bat中調用的appendVELCP批處理腳本為appendVELCP.bat,內容如下:
set VELCP=%VELCP%;%1
總結
以上是生活随笔為你收集整理的运行velocity的官方例子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何解决wps表格下拉数字无法递增的问题
- 下一篇: struts2多文件动态下载及中文解决方