Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open JDK 11 and javah in pom.xml

I switched my java version from java 8 to java 11 , and it seems that in java 11 javah is removed from JDK bin folder, before I was executing the javah command in my pom.xml like below

<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>

Since javah has been removed from JDK 11 how can I replace the above javah command with javac -h in my pom to work with java 11

The error I get is

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (javac -h) on project myProject: Command execution failed.: Process exited with an error: 2 (Exit value: 2)

Any idea? Thanks

like image 326
wearybands Avatar asked Jan 03 '19 10:01

wearybands


1 Answers

You should modify your execution as :

<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>

based on the the javac --help

  -h <directory>
        Specify where to place generated native header files
like image 146
Naman Avatar answered Sep 22 '22 16:09

Naman