Code: Select all
public static File getJreExecutable()
{
String jreDirectory = System.getProperty( "java.home" );
File javaExe = null;
if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
{
javaExe = new File( jreDirectory, "bin/javaw.exe" );
}
else
{
javaExe = new File( jreDirectory, "bin/javaw" );
}
if ( !javaExe.exists() )
{
return null;
}
return javaExe;
}
private static void runKM( String filename )
{
File javaExe = getJreExecutable();
if ( javaExe == null )
{
System.err.println( "Unable to find java executable" );
return;
}
try
{
Runtime r = Runtime.getRuntime();
String classPath = System.getProperty( "java.class.path" );
r.exec( new String[] { javaExe.getCanonicalPath(), "-cp", classPath, "com.hifiremote.jp1.RemoteMaster", "-rm", "-home", workDir.getAbsolutePath(), filename } );
}
catch ( IOException e )
{
e.printStackTrace();
}
}A search of the web found one issue. Apparently javaw does not exist in Linux and one should use java instead. So before the line if ( !javaExe.exists() ) I have added
Code: Select all
if ( !javaExe.exists() )
{
javaExe = new File( jreDirectory, "bin/java" );
}Edit: I am using openJDK build 1.8.0_252.