2012-03-09 37 views
0

一些comamnds當我跑到一個腳本來執行Java應用程序出現了這個畫面的Linux:一個簡單的Linux腳本顯示到屏幕上

SH Joii.sh

Usage: java [-options] class [args...] 
      (to execute a class) 
    or java [-options] -jar jarfile [args...] 
      (to execute a jar file) 

where options include: 
    -d32   use a 32-bit data model if available 

    -d64   use a 64-bit data model if available 
    -server  to select the "server" VM 
        The default VM is server. 

    -cp <class search path of directories and zip/jar files> 
    -classpath <class search path of directories and zip/jar files> 
        A : separated list of directories, JAR archives, 
        and ZIP archives to search for class files. 
    -D<name>=<value> 
        set a system property 
    -verbose[:class|gc|jni] 
        enable verbose output 
    -version  print product version and exit 
    -version:<value> 
        require the specified version to run 
    -showversion print product version and continue 
    -jre-restrict-search | -jre-no-restrict-search 
        include/exclude user private JREs in the version search 
    -? -help  print this help message 
    -X   print help on non-standard options 
    -ea[:<packagename>...|:<classname>] 
    -enableassertions[:<packagename>...|:<classname>] 
        enable assertions 
    -da[:<packagename>...|:<classname>] 
    -disableassertions[:<packagename>...|:<classname>] 
        disable assertions 
    -esa | -enablesystemassertions 
        enable system assertions 
    -dsa | -disablesystemassertions 
        disable system assertions 
    -agentlib:<libname>[=<options>] 
        load native agent library <libname>, e.g 
        see also, -agentlib:jdwp=help and -age 
    -agentpath:<pathname>[=<options>] 
        load native agent library by full pathna 
    -javaagent:<jarpath>[=<options>] 
        load Java programming language agent, se 
    -splash:<imagepath> 
        show splash screen with specified image 

這是我的腳本

echo "Start time: " `date` 


export JAVA_HOME=/usr/local/jdk1.6.0_20 
export PATH=/usr/local/jdk1.6.0_20/bin 

LIB_DIR=/home/rvarre/NewPdpapiToplist1/lib 

export CLASSPATH=.:$LIB_DIR/commons-logging-1.0.4.jar:$LIB_DIR/log4j-1.2.8.jar:$LIB_DIR/mail.jar:$LIB_DIR/marketdata-b1.1.jar:$LIB_DIR/middleware.jar:$LIB_DIR/pdpapi-all.jar 

echo $CLASSPATH 

#Debugging Classpath 

#JVM Parameters 

java -classpath=$CLASSPATH com.tata.topListQuoteSamples.TOPLISTSample 
echo "End time: " `date` 
+1

腳本的內容? – 2012-03-09 15:53:41

+0

你以不好的方式調用了你的java。嘗試先手動做。 – 2012-03-09 15:53:42

+0

類路徑中不應該有等於運算符。 'java -classpath $ CLASSPATH com.tata.topListQuoteSamples.TOPLISTSample' – mcfinnigan 2012-03-09 16:07:55

回答

1

你必須在-classpath參數等號,但預計空間。

嘗試

java -classpath $CLASSPATH com.tata.topListQuoteSamples.TOPLISTSample 

順便說一句,當你提供的是CLASSPATH,你不需要導出它,當它被導出,你不需要爲它供給。所以,在你的情況下,這也應該工作

java com.tata.topListQuoteSamples.TOPLISTSample 

正如評論家所說,你的問題是在你調用java命令的方式,shell腳本確定。所以先嚐試手動。