Nachdem ich das ZIP-Paket heruntergeladen und entpackt habe, kopiere ich die Datei modelsphere.bat nach modelsphere.sh und ändere den Inhalt wie folgt:
java -ms64m -mx512m -ss16m -classpath "./modelsphere.jar:./resources.zip:./resources:./targets:./lib/jakarta-regexp-1.5/jakarta-regexp-1.5.jar:./lib/velocity-1.6.1/velocity-1.6.1.jar:./lib/jazzy-core/jazzy-core.jar:./lib/jython-2.2.1/jython.jar:./lib/velocity-1.6.1/lib/commons-collections-3.2.1.jar:./lib/velocity-1.6.1/lib/commons-lang-2.4.jar:./lib/lablib-checkboxtree-3.0.2.jar" org.modelsphere.sms.Application
aber beim Ausführen von modelsphere.sh mit dem Befehl "./modelsphere.sh" wird folgende Ausnahme ausgelöst:
Exception in thread "main" java.lang.NoClassDefFoundError: org/modelsphere/sms/Application
Caused by: java.lang.ClassNotFoundException: org.modelsphere.sms.Application
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
. Program will exit.in class: org.modelsphere.sms.Application
wenn ich den Befehl ausführe,
java -ms64m -mx512m -ss16m -classpath "./modelsphere.jar:./resources.zip:./resources:./targets:./lib/jakarta-regexp-1.5/jakarta-regexp-1.5.jar:./lib/velocity-1.6.1/velocity-1.6.1.jar:./lib/jazzy-core/jazzy-core.jar:./lib/jython-2.2.1/jython.jar:./lib/velocity-1.6.1/lib/commons-collections-3.2.1.jar:./lib/velocity-1.6.1/lib/commons-lang-2.4.jar:./lib/lablib-checkboxtree-3.0.2.jar" org.modelsphere.sms.Application
Das ist der Inhalt der Datei „modelsphere.sh“, es funktioniert.
warum? und wie kann ich Open ModelSphere mit der Shell-Datei „modelsphere.sh“ starten?
Kann mir jemand einen Hinweis geben? Danke im Voraus.
Antwort1
Es hat wahrscheinlich DOS-Zeilenenden (\r\n statt \n). Siehehttp://mywiki.wooledge.org/BashFAQ/052
Und zur Sicherheit sollten Sie sicherstellen, dass die erste Zeile der Datei lautet:#!/bin/sh