Skip to content

Commit 1fcc519

Browse files
committedOct 18, 2024·
remove error line
1 parent 250cf16 commit 1fcc519

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed
 

‎src/main/java/io/bioimage/modelrunner/pytorch/PytorchInterface.java

-56
Original file line numberDiff line numberDiff line change
@@ -495,79 +495,23 @@ private List<String> getProcessCommandsWithoutArgs() throws IOException, URISynt
495495
command.add("-cp");
496496
command.add(classpath);
497497
command.add(className);
498-
System.out.println(command);
499498
return command;
500499
}
501500

502-
public static List<String> getClassLocations(Class<?>... classes) {
503-
List<String> locations = new ArrayList<>();
504-
for (Class<?> clazz : classes) {
505-
String location = getClassLocation(clazz);
506-
if (location != null && !locations.contains(location)) {
507-
locations.add(location);
508-
}
509-
}
510-
return locations;
511-
}
512-
513-
private static String getClassLocation(Class<?> clazz) {
514-
try {
515-
String classResource = clazz.getName().replace('.', '/') + ".class";
516-
URL location = clazz.getClassLoader().getResource(classResource);
517-
System.out.println(location);
518-
519-
if (location != null) {
520-
String path = extractPath(location);
521-
System.out.println(path);
522-
if (path != null) {
523-
File file = new File(path);
524-
if (file.isFile()) {
525-
// If it's a JAR file
526-
return file.getAbsolutePath();
527-
} else {
528-
// If it's a directory (for .class files)
529-
return file.getParent();
530-
}
531-
}
532-
}
533-
} catch (UnsupportedEncodingException e) {
534-
e.printStackTrace();
535-
}
536-
return null;
537-
}
538-
539-
private static String extractPath(URL url) throws UnsupportedEncodingException {
540-
String path = url.getPath();
541-
if (path.startsWith("file:")) {
542-
path = path.substring(5);
543-
}
544-
path = URLDecoder.decode(path, "UTF-8");
545-
546-
if (path.contains(".jar!")) {
547-
path = path.substring(0, path.lastIndexOf(".jar!") + 4);
548-
}
549-
550-
return path;
551-
}
552-
553501
private static String getCurrentClasspath() throws UnsupportedEncodingException {
554502

555503
String modelrunnerPath = getPathFromClass(DeepLearningEngineInterface.class);
556-
getClassLocations(DeepLearningEngineInterface.class);
557-
System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
558504
String imglib2Path = getPathFromClass(NativeType.class);
559505
String gsonPath = getPathFromClass(Gson.class);
560506
String jnaPath = getPathFromClass(com.sun.jna.Library.class);
561507
String jnaPlatformPath = getPathFromClass(com.sun.jna.platform.FileUtils.class);
562508
if (modelrunnerPath == null || (modelrunnerPath.endsWith("DeepLearningEngineInterface.class")
563509
&& !modelrunnerPath.contains(File.pathSeparator)))
564510
modelrunnerPath = System.getProperty("java.class.path");
565-
modelrunnerPath = System.getProperty("java.class.path");
566511
String classpath = modelrunnerPath + File.pathSeparator + imglib2Path + File.pathSeparator;
567512
classpath = classpath + gsonPath + File.pathSeparator;
568513
classpath = classpath + jnaPath + File.pathSeparator;
569514
classpath = classpath + jnaPlatformPath + File.pathSeparator;
570-
571515
return classpath;
572516
}
573517

0 commit comments

Comments
 (0)
Please sign in to comment.