Can an embedded Java Applet be hosted on Git-Pages

2019-08-05 08:40发布

问题:

I want to embed a java applet (stored in a git repository) in the accompanying github-pages page. Is this possible?

回答1:

Yes.

Although GitHub pages can be generated through a simple markdown interface, any files in your branch will be served as part of your gh-pages-site.

This means you can host client side scripts like Java-Applets or JS on your GitHub Pages site.

To host a java applet:

  1. Create a jar file for your Applet.
  2. Place the .jar file into the root of your gh-pages branch.
  3. Embed the applet in one of your html pages using your prefered method like this, or maybe this:

    *Assuming foo.jar and Bar.class are your file and applet-class*
    <embed 
    id="SomeName"
    type="application/x-java-applet;version=1.6"
    width="999" height="999" 
    archive="foo.jar"
    code="Bar.class"
    pluginspage="http://java.com/download/"
    myParam="YourParams" />
    
  4. Commit/Push the changes and wait (sometimes gh-pages are not updated immediately).