嵌入Java小程序在GitHub上页 [英] Embed Java Applet on GitHub Page

查看:200
本文介绍了嵌入Java小程序在GitHub上页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,我在GitHub上托管的Java项目。我想用GitHub上的页面有托管在GitHub上嵌入小程序的页面。现在,我试图嵌入一个applet到网页中,与在GitHub上托管在 GH-页分支的小应用程序文件。我出口的Java小程序为爆炸,在正确的层次结构,以便所有的类文件中显示出来。在`index.html的,我用这个code:

I am working on a Java project that I am hosting on GitHub. I wanted to use GitHub Pages to have a page hosted on GitHub with the applet embedded. Now, I'm trying to embed an applet into the page, with the applet files hosted on GitHub on the gh-pages branch. I exported the Java applet as "exploded", so all of the class files show up in their correct hierarchy. In `index.html, I'm using this code:

<section id="main_content">
            <script>
                var attributes = {codebase: 'cubesorter/me/nrubin29/cubesorter/',
                    code: 'Viewer.class',
                    archive: 'cubesorter.jar',
                    width: '800',
                    height: '600'};
                var parameters = {java_arguments: '-Xmx256m'}; // customize per your needs
                var version = '1.5'; // JDK version
                deployJava.runApplet(attributes, parameters, version);
            </script>
        </section>

不过,我得到一个的ClassNotFoundException Viewer.class 。难道我把一切都设置正确?

However, I get a ClassNotFoundException for Viewer.class. Do I have everything set up correctly?

推荐答案

您需要viewer.class迁入cubesorter /树/ GH-pages目录。
简单的修复。没有更给它。

You need to move viewer.class into the cubesorter/tree/gh-pages directory. Simple fix. Not much more to it.

 <!-- try the applet tag instead -->
 <applet src="cubesorter.jar" code="https://github.com/nrubin29/cubesorter/blob/gh-pages/cubesorter/me/nrubin29/cubesorter/Viewer.class?raw=true">Java not supported</applet>

 <!-- <section id="main_content">
        <script>
            var attributes = {codebase: 'cubesorter/me/nrubin29/cubesorter/',
                //How is this even parsed?
                code: 'https:\/\/github.com\/nrubin29\/cubesorte\r/blob/gh-pages/\cubesorter\/me\/nrubin29\/cubesorter\/Viewer.class?raw=true',
                archive: 'cubesorter.jar',
                width: '800',
                height: '600'};
            var parameters = {java_arguments: '-Xmx256m'}; // customize per your needs
            var version = '1.5'; // JDK version
            deployJava.runApplet(attributes, parameters, version);
        </script>
 </section> -->

在code以上,热链接我为viewer.class您

In the code above, I hotlinked viewer.class for you

这篇关于嵌入Java小程序在GitHub上页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆