2013-05-06 50 views
-1

看完这个问题之后 Setting multiple jars in java classpath 我还是很困惑。是否有唯一的方法来指定一个类路径,以便它可以在Linux和Windows中运行? 例如,我正在运行这两个命令,并且在Linux中使用'*'通配符后,我需要放入':',但是在Windows中 - ';'。以跨平台的方式设置Java类路径

java -mx1300m -cp "*;" edu.stanford.nlp.parser.lexparser.LexicalizedParser -outputFormat "wordsAndTags,typedDependencies,penn" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz %1 

java -mx500m -cp "$scriptdir/*:" edu.stanford.nlp.parser.lexparser.LexicalizedParser \ 
-outputFormat "typedDependencies" edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz $* 

谢谢。

回答

2

有没有这样的事情。您应该创建一个单独的“.sh”和“.bat”文件,或者您可以将所有程序依赖关系放入“.jar”文件中,并将其转换为可执行文件。您只需要任何操作系统上的jar文件,因为您具有兼容的jvm。