public static final boolean isLinux () { return _isLinux; }
/**
+ * Check if a symlink (or file) points to a JVM
+ */
+ private static boolean checkJVMSymlink(String testBin)
+ {
+ File testBinFile = new File(testBin);
+ if (!testBinFile.exists())
+ {
+ return false;
+ }
+ File targetFile = null;
+ try
+ {
+ targetFile = testBinFile.getCanonicalFile();
+ } catch (IOException e)
+ {
+ return false;
+ }
+ if (targetFile != null && ("java".equals(targetFile.getName())
+ || "java.exe".equals(targetFile.getName())))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Checks whether a Java Virtual Machine can be located in the supplied path.
*/
protected static String checkJVMPath (String vmhome, boolean windebug)
{
String vmbase = vmhome + File.separator + "bin" + File.separator;
- String vmpath = vmbase + "java";
+ String appName = System.getProperty("channel.app_name", "Jalview");
+ String vmpath = vmbase + appName;
+ if (checkJVMSymlink(vmpath)) {
+ return vmpath;
+ }
+ vmpath = vmbase + "Jalview";
+ if (checkJVMSymlink(vmpath)) {
+ return vmpath;
+ }
+ vmpath = vmbase + "java";
if (new File(vmpath).exists()) {
return vmpath;
}