我是新來的sygwin,所以我可能做錯了什麼。爲什麼在cygwin中找不到jar文件?
這裏是我的shell腳本:
!/bin/sh
set [-x]
export myInstallDirectory='/cygdrive/c/cygwin64/usr/uTrace_ServerMachine'
echo "myInstallDirectory=" $myInstallDirectory
export JAVA_HOME=/cygdrive/c/Java_JDK_SE_8_u77_64_bit
echo "JAVA_HOME = " $JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
echo "PATH =" $PATH
export CLASSPATH=$myInstallDirectory/bin/UtraceServer.jar:$CLASSPATH
echo "CLASSPATH=" $CLASSPATH
java -jar UtraceServer.jar
set [+x]
這裏是日誌顯示:
myInstallDirectory= /cygdrive/c/cygwin64/usr/uTrace_ServerMachine
JAVA_HOME = /cygdrive/c/Java_JDK_SE_8_u77_64_bit
PATH = /cygdrive/c/Java_JDK_SE_8_u77_64_bit
/斌:在/ usr/local/bin目錄:在/ usr/bin中:/ cygdrive/C/windows/system32:/ cygdrive/c/ProgramData/Oracle/Java/javapath:/ cygdrive/c/Program Files/Intel/WiFi/bin:/ cygdrive/c/Program Files/Common Files/Intel/WirelessCommon:/ cygdrive/C/WINDOWS:/cygdrive/c/WinZip/WINZIP/WINZIP32.EXE:/ cygdrive/C/Java_JDK_SE_8_u77_64_bit/bin中:/cygdrive/c/Java_JDK_SE_8_u77_64_bit/lib/tools.jar:/ cygdrive/C/Java_EE_SDK_7_u2/glassfish4 /bin:/cygdrive/c/Java_EE_SDK_7_u2/glassfish4/glassfish/bin:/cygdrive/c/Java_EE_SDK_7_u2/glassfish4/glassfish/lib/javaee.jar:/cygdrive/c/IBM/Derby/db-derby-10.12.1.1-斌/ lib目錄/ derbynet.jar:/cygdrive/c/IBM/Derby/db-derby-10.12.1.1-bin/lib/derbytools.jar:/cygdrive/c/IBM/Derby/db-derby-10.12.1.1-箱/ LIB/derbyoptionaltools.jar:/cygdrive/c/IBM/Derby/db-derby-10.12.1.1-bin/test/jakarta-oro-2.0.8.jar:/ cygdrive/C/IBM /德比/ DB-德比-10.12.1.1濱/測試/ derbyTesting.jar:/cygdrive/c/IBM/Derby/db-derby-10.12.1.1-bin/lib/derbyrun.jar:/ cygdrive/C/IBM/DB2_EX〜1 /的java/db2java.zip:/cygdrive/c/IBM/DB2_EX~1/java/db2jcc.jar:/cygdrive/c/IBM/DB2_EX~1/java/sqlj.zip:/ cygdrive/C/IBM/DB2_EX〜1 /java/db2jcc_license_cu.jar:/cygdrive/c/IBM/DB2_EX~1/bin:/cygdrive/c/IBM/DB2_EX~1/java/common.jar:/cygdrive/c/ORACLE/NetBeans 8.1/java/maven/bin:/ cygdrive/c/Program Files(x86)/ Skype/Phone:/ cygdrive/c/Cygwin/bin:/ cygdrive/c/Program Files/Microsoft Network Monitor 3:/ cygdrive/c/My_Software_Development/Client_Monitoring/PTS
CLASSPATH =/cygdrive/C/cygwin64的/ usr/uTrace_ServerMachine /bin/UtraceServer.jar:.;C:\Java_JDK_SE_8_u77_64_bit\lib\tools.jar;C:\Java_EE_SDK_7_u2\glassfish4\glassfish\lib\javaee的.jar; C:\ IBM \德比\ DB-德比-10.12.1.1槽\ lib中\ derbynet.jar; C:\ IBM \德比\ DB-德比-10.12.1.1槽\ lib中\ derbytools.jar; C^:\ IBM \德比\ DB-德比-10.12.1.1槽\ lib中\ derbyoptionaltools.jar; C:\ IBM \德比\ DB-德比-10.12.1.1槽\測試\雅加達口 - 2.0.8.jar ; C:\ IBM \德比\ DB-德比-10.12.1.1槽\測試\ derbyTesting.jar; C:\ IBM \德比\ DB-德比-10.12.1.1槽\ lib中\ derbyrun.jar; C:\ IBM \ DB2_EX〜1個\的java \ db2java.zip; C:\ IBM \ DB2_EX〜1 \的java \的db2jcc.jar; C:\ IBM \ DB2_EX〜1 \的java \ sqlj.zip; C:\ IBM \ DB2_EX〜1 \ java \ db2jcc_license_cu.jar; C:\ IBM \ DB2_EX〜1 \ bin; C:\ IBM \ DB2_EX〜1 \ java \ common.jar
錯誤:無法訪問jar文件UtraceServer.jar
jar文件UtraceServer.jar位於/cygdrive/c/cygwin64/usr/uTrace_ServerMachine/bin/UtraceServer.jar ,正如你可以看到它是在CLASSPATH中。 感謝任何幫助。
我不認爲這是正確的。 Internet上甚至有一個文檔解釋瞭如何使Cygwin使用安裝在Windows機器上的Java環境。由於某種原因,它不適用於我的情況。 – i262666
我並不是說不可能使用Windows JDK,只是你不能這樣做。 – matzeri
matzeri,這是正確的,但是我將Windows機器上安裝的Java的位置包含在文件.bashre中。 – i262666