简体   繁体   English

如何从 windows git shell/gnu makefile 调用 javac

[英]how to invoke javac from windows git shell/gnu makefile

I was working home office with my linux box, was sure to write portable code.我正在用我的 linux 盒子在家庭办公室工作,一定会写出可移植的代码。 Used shell and gnumake and compiled java through使用 shell 和 gnumake 编译 java 通过

javac -Xlint:deprecation -Xlint:unchecked --module-path libs/nrjavaserial-4.0.1.jar:libs/jep-3.9.0.jar:libs/commons-beanutils-1.9.4.jar:libs/commons-collections-3.2.2.jar:libs/commons-logging-1.2.jar:src/  src/main/de/name/product/Product.java -d target/classes/

All ok.一切都好。 Now in office with windows 10 but still gnumake, does not work.现在在办公室 windows 10 但仍然 gnumake,不起作用。 Also from git bash, no.同样来自 git bash,编号。

I would be content as a first step to get it run in gitshell.作为让它在 gitshell 中运行的第一步,我会很满足。 I use javac 11.0.7 and 2.26.0.windows.1 .我使用javac 11.0.72.26.0.windows.1

The errors (i cannot show in full because related to customer) show that no jar has been accepted:错误(我无法完整显示,因为与客户有关)表明没有 jar 已被接受:

 error: cannot find symbol
       NRSerialPort serial = getSingleSerialPort(baudRate);
        ^
  symbol:   class NRSerialPort
  location: class xxx

shows that libs/nrjavaserial-4.0.1.jar is not accepted athough present and表明libs/nrjavaserial-4.0.1.jar不被接受,尽管存在并且

 error: cannot find symbol
        } catch(JepException e) {
                ^
  symbol:   class JepException
  location: class XXX

shows that libs/jep-3.9.0.jar is not accepted.表明libs/jep-3.9.0.jar不被接受。 Note that on linux all works fine on an ordinary bash shell.请注意,在 linux 上,在普通的 bash shell 上一切正常。

Maybe separators wrong for windows?也许 windows 的分隔符错误? I always thought, separators are transparent on git bash?我一直认为,分隔符在 git bash 上是透明的? or only / but not:?或只有/但不是:? I tried several combinations, without success.我尝试了几种组合,但没有成功。

I suspect all quite easy... right?我怀疑一切都很容易......对吧?

You've guessed right, you need to use different separators on Windows.你猜对了,你需要在 Windows 上使用不同的分隔符。

See https://docs.oracle.com/en/java/javase/13/docs/specs/man/javac.html请参阅https://docs.oracle.com/en/java/javase/13/docs/specs/man/javac.html

In the following lists of options, an argument of path represents a search path, composed of a list of file system locations separated by the platform path separator character, (semicolon; on Windows, or colon: on other systems.) Depending on the option, the file system locations may be directories, JAR files or JMOD files.在以下选项列表中,path 的参数表示搜索路径,由由平台路径分隔符分隔的文件系统位置列表组成(分号;在 Windows 上,或冒号:在其他系统上。)取决于选项,文件系统位置可能是目录、JAR 文件或 JMOD 文件。

If you want portability, ease-of-use and maintainability, use something like ant, maven or gradle.如果您想要便携性、易用性和可维护性,请使用 ant、maven 或 gradle 之类的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM