Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

after download and unzip the zip package, I copy the modelsphere.bat file to modelsphere.sh, and change the content to:

 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

but when running the modelsphere.sh with the command "./modelsphere.sh", following exception is thrown:

 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

when I run the command,

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

which is the content of the "modelsphere.sh" file, it works.

why? and how could I start Open ModelSphere with the shell file of "modelsphere.sh"?

Could anyone give me any point? thanks in advance.

share|improve this question

1 Answer 1

It probably has DOS line endings (\r\n instead of \n). See http://mywiki.wooledge.org/BashFAQ/052

And for good practice, you should make sure the first line of the file says #!/bin/sh

share|improve this answer
    
to see if it has DOS end-of-lines: shell> cat -vt modelsphere.sh (and look for ^M at the end). To fix, run "dos2unix modelsphere.sh" (or tofrodos utils, or just edit the file & remove the ^M).. –  michael_n Jan 12 '12 at 8:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.