2021年5月6日星期四

Can not use JNA: com.sun.jna.Library is not accessible

I am trying to use JNA, because I want to work with a .dll that was written in c++ and the rest of my code is in Java. However, if I try to import the JNA classes Eclipse claims "The type com.sun.jna.Library is not accessible".

My IDE seems to see that JNA is somehow in my libraries because when I type "import com.sun.j" it proposes .jna and the other packages in the .jar files to me.

I have created a seperate Project to see if it works there, but it just doesnt work.

I have downloaded the latest .jar (jna-5.8.0.jar and jna-platform-5.8.0.jar) files from the jna Github (https://github.com/java-native-access/jna/blob/master/README.md ) and I have added them to the class path via project-> configure Buildpath -> add External JARs

I am using Eclipse with javaSE-13.

package Testtest;    import com.sun.jna.Library;  import com.sun.jna.Native;  import com.sun.jna.Platform;    public class Main {        public static void main(String[] args) {          // TODO Auto-generated method stub        }  }  

Package strcuture:

Test   |-- src   |   |-- TestTest   |   |   |-- Main.java   |   |-- module-info.java   |-- JRE System Library [JavaSE-13]   |-- Referenced Libraries       |-- jna-5.8.0-jar       |-- jna-platform-5.8.0-jar  
https://stackoverflow.com/questions/67401972/can-not-use-jna-com-sun-jna-library-is-not-accessible May 05, 2021 at 09:07PM

没有评论:

发表评论