Я пытаюсь запустить пример VRP, предоставляемый Google OR-Tools, получая сообщение об ошибке в MAC, но то же самое работает в Windows. '
Ошибка:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/rajkumarsavu/Rajkumar/WebRelated/SpringBoot/Projects/google_test/target/classes/jniortools.dll: dlopen(/Users/rajkumarsavu/Rajkumar/WebRelated/SpringBoot/Projects/google_test/target/classes/jniortools.dll, 1): no suitable image found. Did find:
/Users/rajkumarsavu/Rajkumar/WebRelated/SpringBoot/Projects/google_test/target/classes/jniortools.dll: unknown file type, first eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
/Users/rajkumarsavu/Rajkumar/WebRelated/SpringBoot/Projects/google_test/target/classes/jniortools.dll: unknown file type, first eight bytes: 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.google.api.GoogleApplication.loadJarDll(GoogleApplication.java:55)
at com.google.api.GoogleApplication.main(GoogleApplication.java:36)
И сохранил мой файл jniortools.dll в папке ресурсов.
Код:
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients
public class GoogleApplication {
public static void main(String[] args) {
loadJarDll("jniortools.dll");
SpringApplication.run(GoogleApplication.class, args);
}
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
public static void loadJarDll(String fileName) {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
File file = new File(classLoader.getResource(fileName).getFile());
//File is found
System.out.println("File Found : " + file.exists());
//Read File Content
System.out.println(file.getAbsolutePath());
System.load(file.getAbsolutePath());
}
}
Пожалуйста, помогите мне. Примечание: этохорошо работает в системах Windows.