Derby错误:无法找到或加载主类org.apache.derby.drda.NetworkServerControl

时间:2016-01-07 18:52:17

标签: java derby

我刚刚在Windows 10。12。1。1(2015年10月11日/ SVN 1704137)上安装了Apache Derby的最新官方版本

并尝试将其安装在Derby网络服务器中,一切顺利,但是当我执行此命令(java org.apache.derby.drda.NetworkServerControl start -h myhost -p 1368)以使其接受IP其他时比localhost我得到这个错误(正如你在下面看到的那样,在这个命令之前一切都很好)

C:\>set DERBY_INSTALL=C:\Apache\db-derby-10.12.1.1-bin


C:\>set CLASSPATH=%DERBY_INSTALL%\lib\derbyclient.jar;%DERBY_INSTALL%\lib\derbytools.jar;.


C:\>cd %derby_install%\bin


C:\Apache\db-derby-10.12.1.1-bin\bin>setNetworkClientCP.bat


C:\Apache\db-derby-10.12.1.1-bin\bin>SET DERBY_HOME=C:\Apache\DB-DER~1.1-B


C:\Apache\db-derby-10.12.1.1-bin\bin>set CLASSPATH=C:\Apache\DB-DER~1.1-B\lib\derbyclient.jar;C:\Apache\DB-DER~1.1-B\lib\derbytools.jar;C:\Apache\DB-DER~1.1-B/lib/derbyoptionaltools.jar;C:\Apache\db-derby-10.12.1.1-bin\lib\derbyclient.jar;C:\Apache\db-derby-10.12.1.1-bin\lib\derbytools.jar;.


C:\Apache\db-derby-10.12.1.1-bin\bin>java org.apache.derby.tools.ij

ij version 10.12

ij> connect 'jdbc:derby://localhost:1527/MyDbTest';

ij> disconnect;

ij> exit;


C:\Apache\db-derby-10.12.1.1-bin\bin>java 
org.apache.derby.drda.NetworkServerControl start -p 1368

Error: Could not find or load main class 
org.apache.derby.drda.NetworkServerControl


C:\Apache\db-derby-10.12.1.1-bin\bin>cd..


C:\Apache\db-derby-10.12.1.1-bin>cd lib


C:\Apache\db-derby-10.12.1.1-bin\lib>java org.apache.derby.drda.NetworkServerControl start -p 1368

错误:无法找到或加载主类org.apache.derby.drda.NetworkServerControl

我仔细检查并确保在lib文件夹中找到jar文件derbynet.jar并且还包含类NetworkServerControl

1 个答案:

答案 0 :(得分:2)

我找到了答案,我只想发布,以防有​​人遇到同样的问题,所以 而不是使用

 C:\Apache\db-derby-10.12.1.1-bin\lib>java org.apache.derby.drda.NetworkServerControl start -h hostname -p 1368

只是以这种方式使用它,它对我有用

C:\Apache\db-derby-10.12.1.1-bin\lib>java -jar derbynet.jar start -p hostname -p 1368