#!/bin/bash
#echo off
echo -n Enter acl File Location
read acl
echo -n Enter target sql File Location
read sql
cd bin
pwd
java -cp .:../lib/dom4j-1.6.1.jar:../lib/poi-3.8-20120326.jar:../lib/poi-ooxml-3.8-20120326.jar:../lib/poi-ooxml-schemas-3.8-20120326.jar:../lib/stax-api-1.0.1.jar:
.:../lib/xmlbeans-2.3.0.jar com/paywithisis/gateway/utility/XLSXToSQLConverter $acl $sql
cd ..
echo $acl
echo $sql
错误味精:
../lib/xmlbeans-2.3.0.jar: line 1: PK: command not found
../lib/xmlbeans-2.3.0.jar: line 2: Lk¶6: command not found
../lib/xmlbeans-2.3.0.jar: line 3:Kk¶6KAKÛnMETA-INF/MANIFEST.MF}AkÂ@…ï
ûæØv“h!7-„Úƒ¶â¬ÉXÙÙ°: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 3: ¶úï›5: command not found
../lib/xmlbeans-2.3.0.jar: line 4: B¯óÞ: command not found
../lib/xmlbeans-2.3.0.jar: line 4: óÞ¬
5
¬¶èC㨄‰N¥˜ÓŸÉ¼3Õ¡ŸõâLO¥xöhkµ¸¡³ÏI¦öi›Áª©¼
—Àh,©ÒRHñf,–àüWb®¼älÛ=: command not found
../lib/xmlbeans-2.3.0.jar: line 5: IÏsÖñxjgÛE”à{È™Îuªü´HŸòBŠ¥íZŒU½7Ül=°õ}gKýOÜÕÎy6îÀ?Æ#¼¸ÕWËÝÊÇúµ„#sW: command not found
../lib/xmlbeans-2.3.0.jar: line 5: cµ[œØ:þàPK: command not found
../lib/xmlbeans-2.3.0.jar: line 6: 9k¶6org/PK: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 7: 9k¶6
org/apache/PK: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 8: :k¶6org/apache/xmlbeans/PK: No such file or directory
../lib/xmlbeans-2.3.0.jar: line 9: syntax error near unexpected token `)'
../lib/xmlbeans-2.3.0.jar: line 9: 9k¶6«f)¸}¿'org/apache/xmlbeans/BindingConfig.class•T]OA=Ó.jµˆÈ7*‚вúBŒ I%Å`j©mC$>é2-
Ë,n·¦?KäÁÄ€?ÊxgwÅÒ.´¼ÌݽwϹ瞹íï??~x=ŽRƒèGZK1,Ç°ÃÓV&²ï
å½ýí|9[ÜÊlf÷³Ëû™b1³Çþ”³šÎO¹q(ôæ‰U\Öõmé
答案 0 :(得分:4)
问题似乎是以下命令被分成两部分:
java -cp .:../lib/dom4j-1.6.1.jar:../lib/poi-3.8-20120326.jar:../lib/poi-ooxml-3.8-20120326.jar:../lib/poi-ooxml-schemas-3.8-20120326.jar:../lib/stax-api-1.0.1.jar:
.:../lib/xmlbeans-2.3.0.jar com/paywithisis/gateway/utility/XLSXToSQLConverter $acl $sql
您需要在.:../lib/xmlbeans-2.3.0.jar
否则shell会尝试直接执行../lib/xmlbeans-2.3.0.jar
,从而导致您看到的错误。
答案 1 :(得分:2)
看起来它正在尝试将运行 JAR文件作为脚本。 PK
和MANIFEST
字符串是压缩JAR文件中的字符串。
您可能想要检查类路径中是否没有错误的空格(或其他有趣的角色)。
答案 2 :(得分:0)
当我将Java命令从bat文件复制到sh文件时,发生了同样的问题。在Windows中,类路径分隔符为';'。在Linux中,分隔符为':'