Issue #2919 fix windows error due to gempak library missing
Former-commit-id:82ee3e7104
[formerly6edec10edc
[formerly747ac58166
] [formerly82ee3e7104
[formerly 5a2ba132d9e32ce8a018f35ba2524881e5276120]]] Former-commit-id:6edec10edc
[formerly747ac58166
] Former-commit-id:6edec10edc
Former-commit-id:a3220cf170
This commit is contained in:
parent
2a15f0bdd8
commit
a472d0ad34
2 changed files with 32 additions and 3 deletions
|
@ -26,6 +26,7 @@ gov.noaa.nws.ncep.viz.rsc.idft
|
|||
gov.noaa.nws.ncep.viz.rsc.intlsig
|
||||
gov.noaa.nws.ncep.viz.rsc.lightning
|
||||
gov.noaa.nws.ncep.viz.rsc.mosaic
|
||||
gov.noaa.nws.ncep.viz.rsc.ncgrid
|
||||
gov.noaa.nws.ncep.viz.rsc.ncscat
|
||||
gov.noaa.nws.ncep.viz.rsc.nonconvsigmet
|
||||
gov.noaa.nws.ncep.viz.rsc.plotdata
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package gov.noaa.nws.ncep.viz.gempak.nativelib;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
|
@ -10,20 +11,47 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* Utility to load a specific native library
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- -----------------------------------------
|
||||
* --/--/---- Initial Creation
|
||||
* Mar 20, 2014 2919 njensen Safety checks, better error messages
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
public class LibraryLoader {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(LibraryLoader.class);
|
||||
|
||||
public static void load(String libName) {
|
||||
URL url = null;
|
||||
Path path = null;
|
||||
try {
|
||||
Bundle b = Activator.getDefault().getBundle();
|
||||
url = FileLocator.find(b, new Path(System.mapLibraryName(libName)),
|
||||
null);
|
||||
path = new Path(System.mapLibraryName(libName));
|
||||
url = FileLocator.find(b, path, null);
|
||||
if (url == null) {
|
||||
throw new FileNotFoundException("Unable to locate "
|
||||
+ path.toString());
|
||||
}
|
||||
url = FileLocator.resolve(url);
|
||||
System.load(url.getPath());
|
||||
} catch (Exception e) {
|
||||
String msg = "Could not Load native Library: " + url.getFile();
|
||||
String msg = "Could not load native Library: ";
|
||||
if (url != null) {
|
||||
msg += url.getFile();
|
||||
} else {
|
||||
msg += path.toString();
|
||||
}
|
||||
statusHandler.handle(Priority.PROBLEM, msg, e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue