问题
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 upgradejavah
to support recent new paradigms, such as API access via the Compiler API injavax.tools.*
, or the newjava.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