【问题标题】:Spring Boot Gradle add Native library failed (java.lang.UnsatisfiedLinkError)Spring Boot Gradle 添加 Native 库失败(java.lang.UnsatisfiedLinkError)
【发布时间】:2023-03-25 22:49:02
【问题描述】:

我正在尝试将本机库(.dll 文件)添加到基本的 spring gradle 项目中。 我尝试了许多不同的设置,但它们都不适用于基本的 java 项目,我通过添加 VM 参数成功运行了该 dll 文件:java.library.path gradle 这是脚本:

buildscript {
  ext {
    springBootVersion = '1.2.5.RELEASE'
  }
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
  }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot' 

jar {
    baseName = 'messaging'
    version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile("org.springframework.boot:spring-boot-starter-aop")
    compile("org.springframework.boot:spring-boot-starter-amqp")
    compile("org.springframework:spring-messaging")
    compile('javax.inject:javax.inject:1')
    compile('com.google.guava:guava:11.0.2')
    compile('org.codehaus.jackson:jackson-core-asl:1.1.0')
    compile('org.codehaus.jackson:jackson-mapper-asl:1.9.13')
    testCompile("org.springframework.boot:spring-boot-starter-test") 
   }

   task wrapper(type: Wrapper) {
      gradleVersion = '2.3'
   }

我试过了:

在 Eclipse 上添加 VM 参数 添加jvm属性 添加 gradle 系统属性(无法成功添加该参数)

【问题讨论】:

    标签: spring gradle java-native-interface spring-boot jvm-arguments


    【解决方案1】:

    我不明白为什么,但是当我按照以下步骤操作时,它起作用了: 1.我改了java包名 2.用gradle重建项目 3. 运行项目

    【讨论】:

      猜你喜欢
      • 2016-11-19
      • 1970-01-01
      • 1970-01-01
      • 2018-09-24
      • 2014-12-27
      • 1970-01-01
      • 1970-01-01
      • 2017-01-14
      • 2016-02-09
      相关资源
      最近更新 更多