ClassNotFound for AppletLoader when exporting a libGDX applet - java

I tried following this to export my libGDX game as a Java applet. The guide was a bit confusing so I might have done something wrong here. This is what I did:
My libGDX game, in Eclipse, looks like this:
Game
Game-Android
Game-Desktop
The desktop game works fine.
As the guide says, the desktop project uses the Lwjgl backend.
Then I created a GameApplet.java in Game-Desktop/src/my.package.name containing
package my.package.name;
import com.badlogic.gdx.backends.lwjgl.LwjglApplet;
public class GameApplet extends LwjglApplet
{
private static final long serialVersionUID = 1L;
public GameApplet()
{
super(new Game(), false);
}
}
I created a directory applet in Game containing
gdx.jar
gdx-backend-lwjgl.jar
gdx-backend-lwjgl-natives.jar
gdx-natives.jar
lwjgl_util_applet.jar
I right-clicked Game in Eclipse and exported it as a JAR with the following settings:
Resources to export:
- Game
-- src
-- libs
Export generated class files and resources
The exported JAR (called Applet.jar) was placed in the applet folder.
I created the index.html file containing
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>HelloApplet!</title>
</head>
<body>
<div id="applet_container">
<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar" codebase="." width="640" height="480">
<param name="al_title" value="HelloApplet">
<param name="al_main" value="my.package.name.GameApplet">
<param name="al_bgcolor" value="000000">
<param name="al_fgcolor" value="ffffff">
<param name="al_jars" value="Applet.jar, gdx.jar, gdx-backend-lwjgl.jar">
<param name="al_windows" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar">
<param name="al_linux" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar">
<param name="al_mac" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar">
<param name="al_solaris" value="gdx-natives.jar, gdx-backend-lwjgl-natives.jar">
<param name="codebase_lookup" value="false">
<param name="java_arguments" value="-Dsun.java2d.noddraw=true -Dsun.awt.noerasebackground=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false -Dsun.java2d.pmoffscreen=false -Xmx800M">
<param name="lwjgl_arguments" value="-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true">
<param name="separate_jvm" value="true">
<param name="codebase_lookup" value="false">
</applet>
</div>
</body>
</html>
I signed the files and uploaded them to my site. On Firefox, OSX, I get a message saying
ClassNotFoundException
org.lwjgl.util.applet.AppletLoader
What did I do wrong?

Related

Running an applet - Blocked by Security

Basically, what I am trying to do is run an applet.
I made applet, tested it (offline, from Eclipse), exported .jar file and posted on dropbox.com. Then I made simple hmtl which should run that applet.
However I can't get pass the Java security (keep getting "Application Blocked by Java Security" error), even after adding dropbox to "Exception Site List" in Java Control Panel.
<!DOCTYPE html>
<html>
<head>
<title>
My Title v3.0
</title>
</head>
<body>
<object width="480" height="360" data="MyNumber.jar" type="application/x-java-applet">
<param name="codebase" value="https://www.dropbox.com/s/mz6y145mwdtge7r/MyNumber.jar?dl=0" />
<param name="code" value="mynumber.online.MyNumberOnline />
<param name="width" value="480" />
<param name="height" value="360" />
<param name="archive" value="MyNumber.jar" />
</object>
</body>
</html>
Is there a way to get past this?
You have to sign this applet with a certificate as the dialog says "identified by a certificate".

JUpload combine with codeigniter

does anyone tried JUpload java applet with codeigniter?
this is my views
<h1 align="center">JUpload PHP Sample Page</h1>
<div align="center">
<APPLET
CODE="wjhk.jupload2.JUploadApplet"
NAME="JUpload"
ARCHIVE="../../../../jar/wjhk.jupload.jar"
WIDTH="640"
HEIGHT="300"
MAYSCRIPT="true"
ALT="The java pugin must be installed.">
<param name="postURL" value="ftp://username:password#host:21/testupload" />
<param name="ftpCreateDirectoryStructure" value="true" />
<param name="showLogWindow" value="onError">
<param name="afterUploadURL" value="javascript:alert('Upload done');">
<param name="debugLevel" value="99">
<param name="showStatusBar" value="True">
<param name="maxFileSize" value="25000000">
<param name="maxChunkSize" value="25000000">
<param name="httpUploadParameterType" value="iteration">
<param name="nbFilesPerRequest" value="100">
<param name="stringUploadSuccess" value="SUCCESS">
<param name="stringUploadWarning" value="WARNING">
<param name="stringUploadError" value="ERROR">
Java 1.5 or higher plugin required.
</APPLET>
</div>
but I have no luck to post my ftp, the error says:
java.lang.SecurityException: java.lang.SecurityException in JUploadPanelImpl.doStartUpload()
before I try with codeigniter, I try with pure PHP and it worked. Please help me how to combine this JUpload with codeigniter
Thank you
First of all, check for bad credentials (username,password).
If that's not the cause then my guess would be that your server doesn't allow remote access to ftp.
Configure your server for proper access.

Can't load Java applet from another directory in HTML

When i try to load an applet with :
<object type="application/x-java-applet" height="300" width="550">
<param name="code" value="Sokoban" />
</object>
when the html file is in the same directory as the applet it loads as expected.
But when the applet is in an another directory the following code won't work :
<object type="application/x-java-applet" height="300" width="550">
<param name="code" value="sokoban/Sokoban" />
</object>
(sokoban is the directory the applet is in, Sokoban is the applet => Sokoban.class)
Use deployJava.js to deploy the applet (linked from the applet info. page).
Use the codebase attribute to point to the sokoban directory.
Since the code attribute needs to be the fully qualified class name, return it to just Sokoban

launching java applet

As far as I can see from the documentation, <applet> is deprecated, and the <object> tag is the preferred method for launching an applet now. But I can't find decent documentation, or even a tutorial on how to use the object tag to launch an applet.
I did see the following question which shows how in javascript but I would prefer to use a tag
launch applet from web page
I need to know how to specify the java engine, how to specify a jar file, where it's stored, and how to specify the class that is executed.
Here's what i have at the moment (but does not work)
<object
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="800" height="600" data="pi.jar">
<param name="code" value="PiLauncher.class"/>
</object>
the claim was in the Oracle 1.5 docs that this classid specifies "the current java engine" but this is completely opaque to me. They also had examples requesting a specific version.
Even if this is true, how do I:
specify the jar file
specify the class (is this correct above)
specify the directory where the code is (is codebase still valid?)
First of all, the syntax is not the same for firefox and IE:
Firefox:
<object classid="clsid:CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA" id="appletId" name="appletName" width="400" height="300">
<param name="code" value="com.myPackage.Applet" />
<param name="codebase" value="../resources/applet/"/>
<param name="ARCHIVE" value="myApplet.jar" />
<param name="cache_archive" value="myApplet.jar" />
<param name="type" value="application/x-java-applet" />
<param name="cache_option" value="plugin" />
<param name="mayscript" value="true" />
// you can set optional parameters here
</object>
IE:
<object width="400" height="300" classid="java:com.myPackage.Applet.class" codebase="../resources/applet/" name="appletName" id="appletId">
<param name="archive" value="myApplet.jar" />
<param name="type" value="application/x-java-applet" />
<param name="cache_option" value="plugin" />
<param name="mayscript" value="true" />
// you can set optional parameters here
</object>
Here is a good link: http://docs.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#object

How to call JS functions from Java Applet?

Well, this is my trouble:
I have an applet that controlls a magnetic stripe reader and I need to call a JS function when the MSR reads a card to catch the data and submit in a form.
The problem is the applet cannot call JS functions when it is called from a remote PC o server, but locally all the code works fine.
I supposed that is a issue of privileges on the browser.
This is my HTML code:
<html>
<head>
<title>Applet Prueba</title>
<script src="jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#AppletPrueba")[0].apOpenPrinter();
$("#AppletPrueba")[0].apActivaMSR();
});
function print()
{
$("#AppletPrueba")[0].apPrintCreditInfo();
}
function setTxtBox(texto)
{
$("#txtBox").val(texto);
}
</script>
</head>
<body>
<object id = "AppletPrueba"
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width = "1"
height = "1">
<param name="code" value="applet.AppletJPos.class"/>
<param name="archive" value="SAppletJPos.jar,Sjpos11021.jar,Sjpos191.jar,SNCRJavaPOS39.jar,SNCRJavaPOSClasses.jar,Sxerces.jar"/>
<param name="scriptable" value="true"/>
<param name="mayscript" value="true"/>
<param name="param0" value="1"/>
<param name="param1" value="Tienda"/>
<param name="param2" value="XXX"/>
<param name="param3" value="RUBEN C. FLORES GARNETT"/>
<param name="param4" value="09 de Marzo de 2012"/>
<param name="param5" value="0.00"/>
<param name="param6" value="0.00"/>
<param name="param7" value="0.00"/>
<param name="param8" value="0.00"/>
<param name="param9" value="0.00"/>
<param name="param10" value="0.00"/>
<param name="param11" value="0"/>
<param name="param12" value="0.00"/>
<param name="param13" value="0.00"/>
<param name="param14" value="0.00"/>
<param name="param15" value="0.00"/>
<param name="param16" value="0.00"/>
<param name="param17" value="0.00"/>
<param name="param18" value="0.00"/>
<param name="param19" value="0.00"/>
<param name="param20" value="0.00"/>
<param name="param21" value="0.00"/>
<param name="param22" value="0.00"/>
<param name="param23" value="0.00"/>
<param name="param24" value="1"/>
</object>
<input type="button" value="Imprime Ticket" onclick="print()" />
<br/>
<input type="text" value="" id="txtBox" />
</body>
And that is the way the applet call the JS function:
AppletContext appletCtxt = getAppletContext();
...
appletCtxt.showDocument(new URL("javascript: setTxtBox('" + editedCardId[0] + "')"));
I really hope somebody can help me.
(I'm sorry if my english is bad :P)
The Oracle tutorial on the matter would probably be useful.
Invoking JavaScript Code From an Applet
The netscape.javascript.JSObject class enables Java applets to
retrieve a reference to JavaScript objects and interact with the web
page.

Categories

Resources