javah missing after JDK install

时光毁灭记忆、已成空白 提交于 2021-02-08 12:33:48

问题


I can find java, javac and javadoc but there is no javah.exe in my jdk\\bin folder.

I tried to reinstall the JDK but it is still missing. How can I get it, why is it missing?

I found a similar question where the operating system was Linux but I can not find answers for Windows users.

My OS is Windows 10. The Java version is 10.0.1.


回答1:


The tool javah.exe was removed in Java 10. The reason is simple, it is obsolete. From JEP 313: Remove the Native-header Generation Tool (javah):

Motivation

The tool has been superseded by superior functionality in javac, added in JDK 8 (JDK-7150368). This functionality provides the ability to write native header files at the time that Java source code is compiled, thereby eliminating the need for a separate tool.

Focusing on the support provided by javac eliminates the need to upgrade javah to support recent new paradigms, such as API access via the Compiler API in javax.tools.*, or the new java.util.spi.ToolProvider SPI added in JDK 9.

So you can just use javac.exe if you are on Java 8 or newer.




回答2:


javah has been superseded by the -h option added to javac in JDK 8.

It is deprecated since Java 9.

See here for details.



来源:https://stackoverflow.com/questions/50352098/javah-missing-after-jdk-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!