[英]Environment Path - Terminal OSX
I can run a java -classpath command without issue directly in terminal but as soon as I try to do it in cron it throws this error: 我可以直接在终端中运行java -classpath命令而不会出现问题,但是一旦我尝试在cron中执行它,就会抛出此错误:
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`
Research has told me that this might be an environment path issue? 研究告诉我,这可能是环境问题吗? How do I tell what my path is when using terminal vs cron? 使用Terminal vs cron时如何知道我的路径?
I'm envoking java right from cron, crontab is something like: 我正在直接从cron调用Java,crontab类似于:
0 3 * * * * java -classpath /Users/tb582/Desktop/sample1.jar:/Users/tb582...... 0 3 * * * * java -classpath /Users/tb582/Desktop/sample1.jar:/Users/tb582 ...
just specify the whole path in cron: 只需在cron中指定整个路径即可:
type "which java" 输入“哪个java”
should output something similar to this: 应该输出类似以下内容:
/usr/bin/java
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.