It does not affect your jar. All it does is run the jar with the XBoot arguments as if you were to do it yourself via command line or batch. Your jar has to do the rest.
Think of it like this:
*User double clicks jar*
Bootloader runs (JVM1 starts).
*Bootloader creates a process/jvm instance and runs jar->Main (JVM2 starts)*
jar->Main runs and shows the gui, loads the applet, does everything as it normally would
*Bootloader stops running (JVM1 dies)*
jar->Main continues to run as it normally would (JVM2 continues).
All in all, you do everything like you normally would. Load your relative libraries, etc.. etc..
Full example:
Bootloader.java:
Java Code:
package eos;import java.io.IOException;import java.net.URLDecoder;/**
* Created by Brandon on 2014-06-28.
*/public class Bootloader
{ private static final String BOOT_FLAGS
= "-Xbootclasspath/p:"; public static void main
(String[] args
) throws IOException { String path
= Bootloader.
class.
getProtectionDomain().
getCodeSource().
getLocation().
getPath(); path
= URLDecoder.
decode(path,
"UTF-8").
replaceAll("\\\\",
"/"); String mainName
= Main.
class.
getCanonicalName(); //change this "Main" to your actual main class. StringBuilder commands
= new StringBuilder
(); commands.
append("javaw ").
append(BOOT_FLAGS
); commands.
append('"').
append("MyBot.jar").
append('"'); //jar file containing your custom canvas.. commands.
append(" -cp ").
append('"').
append("MyBot.jar").
append('"').
append(' ').
append(mainName
); Runtime.
getRuntime().
exec(commands.
toString()); }}
Main.java
Java Code:
package eos;import javafx.application.Platform;import javafx.embed.swing.JFXPanel;import javafx.fxml.FXMLLoader;import javafx.scene.Parent;import javafx.scene.Scene;import javax.swing.*;import java.awt.*;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.io.IOException;import java.net.URL;import java.net.URLClassLoader;import java.util.ResourceBundle;public class Main
{ void init
(String world,
int width,
int height
) throws IOException { Parent root
= FXMLLoader.
load(getClass
().
getResource("/Resources/Eos.fxml"),
ResourceBundle.
getBundle("Resources.Main")); JFrame frame
= new JFrame("Eos"); JFXPanel panel
= new JFXPanel
(); panel.
setLayout(new BorderLayout(0,
0)); panel.
setScene(new Scene
(root,
0,
0)); frame.
add(panel,
BorderLayout.
NORTH); frame.
setDefaultCloseOperation(JFrame.
DISPOSE_ON_CLOSE); frame.
setResizable(false); root.
getChildrenUnmodifiable().
stream().
filter(n
-> n.
getId().
equals("toolBar")).
forEach(n
-> { int menuWidth
= (int)n.
getBoundsInParent().
getMinX() + (int)n.
getBoundsInParent().
getWidth(); int menuHeight
= (int)n.
getBoundsInParent().
getMinY() + (int)n.
getBoundsInParent().
getHeight(); ClientApplet applet
= new ClientApplet
(world, width, height
); applet.
initializeListeners(); panel.
setPreferredSize(new Dimension(menuWidth, menuHeight
)); frame.
add(applet,
BorderLayout.
CENTER); applet.
start(); frame.
revalidate(); frame.
pack(); frame.
setMinimumSize(frame.
getSize()); frame.
setVisible(true); frame.
setResizable(true); frame.
addWindowListener(new WindowAdapter() { @Override
public void windowClosing
(WindowEvent e
) { frame.
setVisible(false); applet.
stop(); } }); }); } public static void main
(String[] args
) { new JFXPanel
(); Platform.
runLater(() -> { try { new Main
().
init("http://runescape.com",
800,
600); } catch (Exception e
) { e.
printStackTrace(); } }); }}
Then in the manifest it'd look like:
Code Code:
Manifest-Version: 1.0
Main-Class: eos.Bootloader
Boot-Class-Path: eos
Notice that the manifest's loader is set to "BootLoader". This way, when the user double clicks the jar, bootloader is ran FIRST. THEN main is ran. Also notice that if you DO NOT want to use the BootLoader class then you can set "Boot-Class-Path" in the manifest itself. I haven't tested BootClassPath in manifest yet but it should work too. Currently I just use the BootLoader class.