com.sun.jna.platform.mac.SystemB$Timeval

错误信息

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/platform/mac/SystemB$Timeval
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	at oshi.SystemInfo.createOperatingSystem(SystemInfo.java:87)
	at oshi.util.Memoizer$1.get(Memoizer.java:61)
	at oshi.SystemInfo.getOperatingSystem(SystemInfo.java:76)
	at test.SystemHardwareInfo.main(SystemHardwareInfo.java:13)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.platform.mac.SystemB$Timeval
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	... 16 more

原因

在引用 oshi-core 依赖时发生的错误

<dependency>  
    <groupId>com.github.oshigroupId>  
    <artifactId>oshi-coreartifactId>  
    <version>6.4.0version>  
dependency>

解决方案


<dependency>  
    <groupId>com.github.oshigroupId>  
    <artifactId>oshi-coreartifactId>  
    <version>6.4.0version>  
    
    <exclusions>        
	    <exclusion>  
            <groupId>net.java.dev.jnagroupId>  
            <artifactId>jnaartifactId>  
        exclusion>  
        <exclusion>            
	        <groupId>net.java.dev.jnagroupId>  
            <artifactId>jna-platformartifactId>  
        exclusion>  
    exclusions>  
dependency>  


<dependency>  
    <groupId>net.java.dev.jnagroupId>  
    <artifactId>jnaartifactId>  
    <version>5.13.0version>  
dependency>  
  
<dependency>  
    <groupId>net.java.dev.jnagroupId>  
    <artifactId>jna-platformartifactId>  
    <version>5.13.0version>  
dependency>

你可能感兴趣的:(IDEA,mac,macos)