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

Installing with Maven = JNI Error #40

Open
nikalsh opened this issue Dec 5, 2019 · 5 comments
Open

Installing with Maven = JNI Error #40

nikalsh opened this issue Dec 5, 2019 · 5 comments

Comments

@nikalsh
Copy link

nikalsh commented Dec 5, 2019

Hi, I'm trying to build a project with mvn compile / install.
Maven is able to download it as a dependency though, I can use system-hook while running the program through my IDE.

The maven built jar can't be run though.

This is the error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: lc/kra/system/keyboard/event/GlobalKeyListener
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: lc.kra.system.keyboard.event.GlobalKeyListener
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 7 more

From my pom.xml:

    <dependencies>
        <dependency>
            <groupId>lc.kra.system</groupId>
            <artifactId>system-hook</artifactId>
            <version>3.5</version>
        </dependency>

    </dependencies>
    <repositories>
        <repository>
            <id>system-hook-mvn-repo</id>
            <url>https://raw.githubusercontent.com/kristian/system-hook/mvn-repo/</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

Any ideas?

@kristian
Copy link
Owner

kristian commented Dec 5, 2019

Which operating system are you using?

@nikalsh
Copy link
Author

nikalsh commented Dec 5, 2019

Which operating system are you using?

I'm on Windows 7 64x

@kristian
Copy link
Owner

When you compile it, are you sure you are not changing the package / class names of the library? If you do so, you would have to also change the JNI part in the .c files provided?

@kristian
Copy link
Owner

The library is now available on Maven Central. Can you please try again consuming it from there? Thanks.

@nikalsh
Copy link
Author

nikalsh commented Apr 27, 2020

The library is now available on Maven Central. Can you please try again consuming it from there? Thanks.

Thanks, I will try

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

2 participants