高级算法bug

This commit is contained in:
2023-08-21 14:49:00 +08:00
parent a63ae4ce15
commit 4e8beab13a

View File

@@ -31,17 +31,21 @@ public class JnaCallDllOrSo {
//linux操作系统 //linux操作系统
this.nameDll = "lib" + name + "_dll"; this.nameDll = "lib" + name + "_dll";
suffix = ".so"; suffix = ".so";
// this.path = "/usr/local/jarfiles/advanceboot/BOOT-INF/classes/";
//this.path = URLDecoder.decode(this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath(), "UTF-8");
} else { } else {
this.nameDll = name; this.nameDll = name;
// this.path = URLDecoder.decode(this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath().replaceFirst("/", ""), "UTF-8");
} }
File tempFile; String tem = "/usr/local/dllFile/"+this.nameDll.concat(suffix);
File dockerFile = new File(tem);
if(!dockerFile.exists()){
boolean f = dockerFile.getParentFile().mkdirs();
boolean d = dockerFile.createNewFile();
System.out.println("文件夹创建:"+f);
System.out.println("文件创建:"+d);
}
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(this.nameDll.concat(suffix))) { try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(this.nameDll.concat(suffix))) {
tempFile = File.createTempFile(this.nameDll, suffix); try (FileOutputStream outputStream = new FileOutputStream(dockerFile)) {
try (FileOutputStream outputStream = new FileOutputStream(tempFile)) {
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int bytesRead; int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) { while ((bytesRead = inputStream.read(buffer)) != -1) {
@@ -49,9 +53,7 @@ public class JnaCallDllOrSo {
} }
} }
} }
this.path = tempFile.getAbsolutePath(); this.path = dockerFile.getAbsolutePath();
System.out.println(1);
System.out.println(1);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
@@ -62,8 +64,6 @@ public class JnaCallDllOrSo {
public String getStrpath() { public String getStrpath() {
return this.path; return this.path;
// String aa = this.path + this.nameDll;
// return aa.replace("/", File.separator);
} }
public void setPath() { public void setPath() {