File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
src/main/java/net/imagej/tensorflow/util Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ Wisconsin-Madison and Google, Inc.</license.copyrightOwners>
119119 <releaseProfiles >sign,deploy-to-scijava</releaseProfiles >
120120
121121 <imagej-updater .version>2.0.0</imagej-updater .version>
122+ <classgraph .version>4.8.172</classgraph .version>
122123 </properties >
123124
124125 <repositories >
@@ -183,6 +184,12 @@ Wisconsin-Madison and Google, Inc.</license.copyrightOwners>
183184 <groupId >org.apache.commons</groupId >
184185 <artifactId >commons-compress</artifactId >
185186 </dependency >
187+ <dependency >
188+ <groupId >io.github.classgraph</groupId >
189+ <artifactId >classgraph</artifactId >
190+ <version >${classgraph.version} </version >
191+ </dependency >
192+
186193
187194 <!-- Test dependencies -->
188195 <dependency >
Original file line number Diff line number Diff line change 3030
3131package net .imagej .tensorflow .util ;
3232
33+ import io .github .classgraph .ClassGraph ;
3334import net .imagej .tensorflow .TensorFlowVersion ;
3435import net .imagej .updater .util .Platforms ;
3536import org .scijava .log .Logger ;
@@ -75,9 +76,12 @@ public static TensorFlowVersion getTensorFlowJARVersion(URL jar) {
7576 if (matcher .find ()) {
7677 // guess GPU support by looking for tensorflow_jni_gpu in the class path
7778 boolean supportsGPU = false ;
78- ClassLoader cl = ClassLoader .getSystemClassLoader ();
79- for (URL url : ((URLClassLoader )cl ).getURLs ()){
80- if (url .getFile ().contains ("libtensorflow_jni_gpu" )) {
79+ ClassGraph cg = new ClassGraph ();
80+ String cp = cg .getClasspath ();
81+ String [] jars = cp .split (File .pathSeparator );
82+
83+ for (String j : jars ){
84+ if (j .contains ("libtensorflow_jni_gpu" )) {
8185 supportsGPU = true ;
8286 break ;
8387 }
You can’t perform that action at this time.
0 commit comments