Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native-maven-plugin seems to use javah from the path, not from $JAVA_HOME #2

Open
ctubbsii opened this issue May 6, 2016 · 5 comments

Comments

@ctubbsii
Copy link
Contributor

ctubbsii commented May 6, 2016

I receive the following error message when building with multiple JDKs installed on the system. The default system java, javac, javah, etc. are using JDK7, while JAVA_HOME is set to JDK8. Normally, maven would use JAVA_HOME to build everything.

Plugin: org.codehaus.mojo:native-maven-plugin:1.0-alpha-8
Goal: javah
Phase: compile
Configuration:

<javahClassNames>
  <javahClassName>path.to.ClassFile</javahClassName>
</javahClassNames>

It appears that the javah command this plugin selected to use was the one from the path, not the one from JAVA_HOME like the rest of the maven plugins do. This is incorrect behavior, and resulted in the following error:

/path/to/JarFile.jar(path/to/ClassFile.class): major version 52 is newer than 51, the highest major version supported by this compiler.
@dantran
Copy link
Contributor

dantran commented May 6, 2016

we will need to extend the plugin to set the java home directory

@ctubbsii
Copy link
Contributor Author

ctubbsii commented Jun 6, 2016

Ugh. This just hit me again, because I'm trying to build on a Jenkins server using Java 1.6, but the javah on the system path is from Java 1.8.

@asymetrixs
Copy link

What is the status of this issue?

@ctubbsii
Copy link
Contributor Author

ctubbsii commented Dec 4, 2018

The javah goal of this plugin should be considered deprecated as of Java 8. The javah tool was removed sometime after Java 8. The functionality was moved into javac. So, this isn't really important anymore.

@josetesan
Copy link

Just for anyone that ends up here.
It can be solved with alpha-9 version, and following plugin configuration :

 <configuration>
     <javahPath>${JAVA_HOME}/bin/javah</javahPath>
     <javahClassNames>
            <javahClassName>com.acme.MyClass</javahClassName>
      </javahClassNames>
 </configuration>      

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants