MCPcopy Index your code
hub / github.com/java-native-access/jna / findJWS

Method findJWS

test/com/sun/jna/WebStartTest.java:287–323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

285 }
286
287 private String findJWS() throws IOException {
288 String JAVA_HOME = System.getProperty("java.home");
289 String BIN = new File(JAVA_HOME, "/bin").getAbsolutePath();
290 File javaws = new File(BIN, "javaws" + (Platform.isWindows()?".exe":""));
291 List<File> tried = new ArrayList<>();
292 tried.add(javaws);
293 if (!javaws.exists()) {
294 // NOTE: OSX puts javaws somewhere else entirely
295 if (Platform.isMac()) {
296 javaws = new File(JAVA_HOME, "../Commands/javaws");
297 tried.add(javaws);
298 if (!javaws.exists()) {
299 // Hack, look for the "old" location
300 javaws = new File("/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws");
301 }
302 }
303 // NOTE: win64 only includes javaws in the system path
304 if (Platform.isWindows()) {
305 FolderInfo info = Native.load("shell32", FolderInfo.class);
306 char[] buf = new char[FolderInfo.MAX_PATH];
307 //int result =
308 info.SHGetFolderPathW(null, FolderInfo.CSIDL_WINDOWS, null, 0, buf);
309 String path = Native.toString(buf);
310 if (Platform.is64Bit()) {
311 javaws = new File(path, "SysWOW64/javaws.exe");
312 }
313 else {
314 javaws = new File(path, "system32/javaws.exe");
315 }
316 }
317 tried.add(javaws);
318 if (!javaws.exists()) {
319 throw new IOException("javaws executable not found, tried " + tried);
320 }
321 }
322 return javaws.getAbsolutePath();
323 }
324
325 // TODO: find some way of querying the current VM for the deployment
326 // properties path

Callers 1

runTestUnderWebStartMethod · 0.95

Calls 8

isWindowsMethod · 0.95
isMacMethod · 0.95
loadMethod · 0.95
SHGetFolderPathWMethod · 0.95
toStringMethod · 0.95
is64BitMethod · 0.95
getPropertyMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected