【发布时间】:2015-12-03 16:39:34
【问题描述】:
我在 Windows 10(早期 7)上使用 H2 数据库已经有一段时间了。在C:\Program Files (x86)\H2\bin 文件夹中,我有一个h2.bat,第一行如下
@java -cp "h2-1.3.176.jar;%H2DRIVERS%;%CLASSPATH%" org.h2.tools.Console %*
当我执行这个文件时,H2 会按需要启动。现在我试图打开 Windows 命令窗口。当我在那里输入同一行并按回车时,我得到了结果
Starts the H2 Console (web-) server, as well as the TCP and PG server.
Usage: java org.h2.tools.Console <options>
When running without options, -tcp, -web, -browser and -pg are started.
Options are case sensitive. Supported options are:
[-help] or [-?] Print the list of options
[-url] Start a browser and connect to this URL
[-driver] Used together with -url: the driver
[-user] Used together with -url: the user name
[-password] Used together with -url: the password
[-web] Start the web server with the H2 Console
[-tool] Start the icon or window that allows to start a browser
[-browser] Start a browser connecting to the web server
[-tcp] Start the TCP server
[-pg] Start the PG server
For each Server, additional options are available;
for details, see the Server tool.
If a service can not be started, the program
terminates with an exit code of 1.
See also http://h2database.com/javadoc/org/h2/tools/Console.html
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Feature not supported: "%*" [50100-176]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
at org.h2.message.DbException.get(DbException.java:178)
at org.h2.message.DbException.get(DbException.java:154)
at org.h2.util.Tool.throwUnsupportedOption(Tool.java:69)
at org.h2.util.Tool.showUsageAndThrowUnsupportedOption(Tool.java:58)
at org.h2.tools.Console.runTool(Console.java:205)
at org.h2.tools.Console.main(Console.java:100)
所以你看到我得到了一个 java 异常。你能解释一下为什么它可以通过执行.bat 文件来工作,以及为了能够手动执行它需要进行哪些更改?我看不出有什么区别。顺便说一句:我当然是先在命令窗口浏览到C:\Program Files (x86)\H2\bin。
【问题讨论】:
-
%* 表示其余参数,它们在批处理文件之外不起作用。就像错误消息所指示的那样。
标签: java windows batch-file h2