java - 在 pom.xml 中打开 JDK 11 和 javah
问题描述
我将我的 java 版本从 java 8 切换到 java 11 ,似乎在 java 11 中 javah 已从 JDK bin 文件夹中删除,然后我在 pom.xml 中执行 javah 命令,如下所示
<execution>
<id>javah</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>javah</executable>
<arguments>
<argument>-classpath</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>-d</argument>
<argument>${build.path}/include</argument>
</arguments>
</configuration>
</execution>
由于 javah 已从 JDK 11 中删除,如何在我的 pom 中将上述 javah 命令替换为 javac -h 以使用 java 11
我得到的错误是
无法在项目 myProject 上执行目标 org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (javac -h):命令执行失败。:进程退出并出现错误:2(退出值:2)
任何想法?谢谢
解决方案
您应该将执行修改为:
<execution>
<id>javach</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>javac</executable>
<arguments>
<argument>-classpath</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>-h</argument>
<argument>${build.path}/include</argument>
</arguments>
</configuration>
</execution>
基于javac --help
-h <directory> Specify where to place generated native header files
推荐阅读
- r - 计算区域中的对象数
- javascript - 我有一个包含所有项目的 JSON,我想要一种将项目自动添加到嵌入页面的方法,但它会为每个项目发送新的嵌入
- reactjs - 错误:尝试预期。ts(1005)。在反应中使用firebase实现登录/注册时
- python - NUMPY (python) 和 ARMADILLO (c++) 给出不同的结果
- java - 使用 javax.persistence.EntityManager 将实体添加到我的 SQL 数据库时出错
- php - POST 类型的路由在 Laravel 的服务器上不起作用
- pandas - Pandas:如何获取非唯一索引的索引值
- aws-api-gateway - AWS API网关,同名不同参数的get和post
- mysql - 从更改日志表中确定给定日期在给定状态下的订单数
- json - 使用 JQ 更新 json 对象的部分值