2012-03-09 4 views
0

Quand je courais un script pour exécuter une application java a montré cet écranlinux: Un simple script Linux montre quelques comamnds à l'écran

de 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 

Cette est mon script

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

Contenu du script? –

+0

Vous avez invoqué votre Java de manière incorrecte. Essayez de le faire manuellement en premier. –

+0

Il ne devrait pas y avoir d'opérateur equals sur votre chemin de classe. 'java -classpath $ CLASSPATH com.tata.topListQuoteSamples.TOPLISTSample' – mcfinnigan

Répondre

1

Vous avez un signe égal dans le paramètre -classpath, mais il s'attend l'espace.

Essayez

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

BTW, lorsque vous fournissez CLASSPATH, vous n'avez pas besoin d'exporter, et quand il est exporté, vous n'avez pas besoin de lui fournir. Donc, en vous, si cela devait aussi travailler

java com.tata.topListQuoteSamples.TOPLISTSample 

Et comme les commentateurs l'ont dit, vous problème est dans la façon dont vous invoquez la commande java, le script shell est OK. Alors essayez d'abord manuellement.