I have a simple java class as shown below.
public class Launcher {
public static void main(String[] args) {
launchURLInBrowser("http://google.com");
}
private static void launchURLInBrowser(String url) {
try {
Process p = Runtime.getRuntime().exec(new String[]{"C:\\Users\\Administrator\\Downloads\\chrome-win\\chrome.exe", "--kiosk", url});
p.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}
The only thing I am doing in the class is to launch chromium web browser in a kiosk mode and it works fine.
Now, I need to bundle this class in jar file and distribute it. I am going to distribute jar alongside the web browser zip. So, I need to put relative path instead of the hard code path I have given now.
My jar distribution will have following folder structure. Chrome browser will not be put inside the jar. It will be external but inside the same folder as shown below.
launcher.jar
chrome-win
-other files and folders
-chrome.exe
How can I do this?