我可以運行Java,而無需直接在終端發出命令-classpath但只要我嘗試做在cron它拋出這個錯誤:環境路徑 - 終端OSX
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 (implies -server, only for x86_64)
-client to select the "client" VM
-server to select the "server" VM
-jvm is a synonym for the "client" VM [deprecated]
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-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`
研究已經告訴我,這可能是一個環境路徑問題?如何知道使用終端vs cron時我的路徑是什麼?
我envoking的java權從cron,crontab的是一樣的東西:
0 3 * * * *的java -classpath /Users/tb582/Desktop/sample1.jar:/Users/tb582 .... ..
你是從腳本還是直接從cron調用'java'?你會發布腳本(或cron調用)嗎? – paulmelnikow