好吧,我正试图让这个 run.bat 在 CentOS 上工作,并且很难让它加载主类。在我的服务器上,它位于 server/build/net/com/Server(mainclass)
这是我的 run.bat
@echo off
title SunScape World 1 - Port 43594
cd ../build
"C:\Program Files\Java\jdk1.7.0_10\bin\java.exe" net/com/Server 43594
pause
这是我在 CentOS 上使用的 .sh
cd ../build
"java" .net.com.Server 43594
pause
这是我得到的错误:
Exception in thread "main" java.lang.NoClassDefFoundError: //pvpscape/build/net/com/Server
Caused by: java.lang.ClassNotFoundException: ..pvpscape.build.net.com.Server
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: ./pvpscape/build/net/com/Server. Program will exit.