Sign in to follow this  
Pickleninja

AppletLoader woes... help is greatly appreciated :(

Recommended Posts

Hey guys,

I've been messing with this for a few days now, and I finally broke down and decided I'd ask for help. I've seen other topics on this issue after a few dozen google searches, and honestly...I tried doing what they did (maybe I missed something), but any help from you guys would be greatly appreciated.

[u][b]Problem:[/b][/u]

So I'm trying to get an applet displayed within a chrome web browser... downloading the applet demo of the gears spinning displays fine, so I know it's not something dealing with the version of java installed on my machine.

Here's the code and java console outputs below:


[b]Java Console[/b]
[source lang="java"]Java Plug-in 10.7.2.11
Using JRE version 1.7.0_07-b11 Java HotSpot™ Client VM
User home directory = C:\Users\Scott
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@1c0cd80
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.
security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws
security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy
security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@1f459c2
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/Scott/workspace/UnembraGame/bin/lwjgl_util_applet.jar
security: Blacklist revocation check is enabled
security: Trusted libraries list check is enabled
security: Trusted libraries list file not found
network: Cache entry not found [url: file:/C:/Users/Scott/workspace/UnembraGame/bin/lwjgl_util_applet.jar, version: null]
security: Accessing keys and certificate in Mozilla user profile: null
security: Loading Deployment certificates from C:\Users\Scott\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loaded Deployment certificates from C:\Users\Scott\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Loading Root CA certificates from C:\Program Files\Java\jre7\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files\Java\jre7\lib\security\cacerts
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: The certificate hasnt been expired, no need to check timestamping info
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
[
accessMethod: ocsp
accessLocation: URIName: [url="http://ocsp.thawte.com"]http://ocsp.thawte.com[/url]
]
]

security: The CRL support is disabled
security: The OCSP support is enabled
security: Use OCSP setting from certificate
cache: CacheEntry IP mismatch: 199.7.54.190 != 199.7.51.190
network: Cache entry not found [url: [url="http://crl.thawte.com/ThawtePremiumServerCA.crl"]http://crl.thawte.co...iumServerCA.crl[/url], version: null]
network: Connecting [url="http://crl.thawte.com/ThawtePremiumServerCA.crl"]http://crl.thawte.co...iumServerCA.crl[/url] with proxy=DIRECT
network: Connecting [url="http://crl.thawte.com:80/"]http://crl.thawte.com:80/[/url] with proxy=DIRECT
network: Downloading resource: [url="http://crl.thawte.com/ThawtePremiumServerCA.crl"]http://crl.thawte.co...iumServerCA.crl[/url]
Content-Length: 49,830
Content-Encoding: null
network: Wrote URL [url="http://crl.thawte.com/ThawtePremiumServerCA.crl"]http://crl.thawte.co...iumServerCA.crl[/url] to File C:\Users\Scott\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\38\2fb889a6-1a953b9a-temp
network: Connecting [url="http://ocsp.thawte.com/"]http://ocsp.thawte.com/[/url] with proxy=DIRECT
network: Connecting [url="http://ocsp.thawte.com:80/"]http://ocsp.thawte.com:80/[/url] with proxy=DIRECT
security: Certificate revocation enabled. Disable security validation optimizations.
security: Certificate revocation enabled. Disable security validation optimizations.
security: Certificate revocation enabled. Disable security validation optimizations.
security: Certificate revocation enabled. Disable security validation optimizations.
cache: CacheEntry IP mismatch: 199.7.54.190 != 199.7.51.190
network: Cache entry not found [url: [url="http://crl.thawte.com/ThawtePCA.crl"]http://crl.thawte.com/ThawtePCA.crl[/url], version: null]
network: Connecting [url="http://crl.thawte.com/ThawtePCA.crl"]http://crl.thawte.com/ThawtePCA.crl[/url] with proxy=DIRECT
network: Connecting [url="http://crl.thawte.com:80/"]http://crl.thawte.com:80/[/url] with proxy=DIRECT
cache: CacheEntry IP mismatch: 199.7.54.190 != 199.7.51.190
network: Downloading resource: [url="http://crl.thawte.com/ThawtePCA.crl"]http://crl.thawte.com/ThawtePCA.crl[/url]
Content-Length: 500
Content-Encoding: null
network: Wrote URL [url="http://crl.thawte.com/ThawtePCA.crl"]http://crl.thawte.com/ThawtePCA.crl[/url] to File C:\Users\Scott\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\56\32a4e8f8-55e58ff6-temp
network: Connecting [url="http://ocsp.thawte.com/"]http://ocsp.thawte.com/[/url] with proxy=DIRECT
security: Certificate revocation enabled. Disable security validation optimizations.
security: Certificate revocation enabled. Disable security validation optimizations.
cache: CacheEntry IP mismatch: 199.7.54.190 != 199.7.51.190
cache: CacheEntry IP mismatch: 199.7.71.190 != 199.7.59.190
network: Cache entry not found [url: [url="http://cs-g2-crl.thawte.com/ThawteCSG2.crl"]http://cs-g2-crl.tha.../ThawteCSG2.crl[/url], version: null]
network: Connecting [url="http://cs-g2-crl.thawte.com/ThawteCSG2.crl"]http://cs-g2-crl.tha.../ThawteCSG2.crl[/url] with proxy=DIRECT
security: Certificate revocation enabled. Disable security validation optimizations.
network: CleanupThread used 865524 us
network: Connecting [url="http://cs-g2-crl.thawte.com:80/"]http://cs-g2-crl.thawte.com:80/[/url] with proxy=DIRECT
network: CleanupThread used 6 us
network: Downloading resource: [url="http://cs-g2-crl.thawte.com/ThawteCSG2.crl"]http://cs-g2-crl.tha.../ThawteCSG2.crl[/url]
Content-Length: 115,181
Content-Encoding: null
network: Wrote URL [url="http://cs-g2-crl.thawte.com/ThawteCSG2.crl"]http://cs-g2-crl.tha.../ThawteCSG2.crl[/url] to File C:\Users\Scott\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\58\13b501ba-64c16eb1-temp
network: CleanupThread used 3 us
security: Certificate validation succeeded using OCSP/CRL
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
network: Cache entry not found [url: file:/C:/Users/Scott/workspace/UnembraGame/bin/lwjgl_util_applet.jar, version: null]
security: Trusted libraries list file not found
network: Cache entry not found [url: file:/C:/Users/Scott/workspace/UnembraGame/bin/lwjgl_util_applet.jar, version: null]
security: Validate the certificate chain using CertPath API
security: The certificate hasnt been expired, no need to check timestamping info
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
[
accessMethod: ocsp
accessLocation: URIName: [url="http://ocsp.thawte.com"]http://ocsp.thawte.com[/url]
]
]

security: The CRL support is disabled
security: The OCSP support is enabled
security: Use OCSP setting from certificate
network: Connecting [url="http://ocsp.thawte.com/"]http://ocsp.thawte.com/[/url] with proxy=DIRECT
network: Connecting [url="http://ocsp.thawte.com/"]http://ocsp.thawte.com/[/url] with proxy=DIRECT
security: Certificate validation succeeded using OCSP/CRL
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
network: Cache entry not found [url: file:/C:/Users/Scott/workspace/UnembraGame/bin/lwjgl_util_applet.jar, version: null]
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
security: Validate the certificate chain using CertPath API
security: The certificate hasnt been expired, no need to check timestamping info
security: Found jurisdiction list file
security: Start checking trusted extension for this certificate
security: Start comparing to jurisdiction list with this certificate
security: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
[
accessMethod: ocsp
accessLocation: URIName: [url="http://ocsp.thawte.com"]http://ocsp.thawte.com[/url]
]
]

security: The CRL support is disabled
security: The OCSP support is enabled
security: Use OCSP setting from certificate
network: Connecting [url="http://ocsp.thawte.com/"]http://ocsp.thawte.com/[/url] with proxy=DIRECT
network: Connecting [url="http://ocsp.thawte.com/"]http://ocsp.thawte.com/[/url] with proxy=DIRECT
security: Certificate validation succeeded using OCSP/CRL
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 335801 us, pluginInit dt 4630578 us, TotalTime: 4966379 us
basic: Loaded image: file:/C:/Users/Scott/workspace/UnembraGame/bin/appletlogo.gif
basic: Loaded image: file:/C:/Users/Scott/workspace/UnembraGame/bin/appletprogress.gif
network: Cache entry not found [url: file:/C:/Users/Scott/workspace/UnembraGame/bin/, version: null]
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started
This occurred while 'Switching applet'
org.lwjgl.test.applet.UnembraGame
java.lang.ClassNotFoundException: UnembraGame
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1315)
at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
[/source]
Project setup
[source]
UnembraGame
-> src
-> (default package)
-> UnembraGame.java
-> JRE System Library
-> Referenced Library

[/source]


[b]UnembraGame.java[/b]
[source]
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GLContext;
import static org.lwjgl.opengl.ARBTransposeMatrix.*;
import static org.lwjgl.opengl.GL11.*;
@SuppressWarnings("serial")
public class UnembraGame extends Applet {
/** The Canvas where the LWJGL Display is added */
Canvas display_parent;
/** Thread which runs the main game loop */
Thread gameThread;
/** is the game loop running */
boolean running;
/** variables used to rotate the view */
private float view_rotx = 20.0f;
private float view_roty = 30.0f;
private float view_rotz;
private int gear1;
private int gear2;
private int gear3;
private float angle;
boolean keyDown;
private int prevMouseX, prevMouseY;
private boolean mouseButtonDown;

/**
* Once the Canvas is created its add notify method will call this method to
* start the LWJGL Display and game loop in another thread.
*/
public void startLWJGL() {
gameThread = new Thread() {
public void run() {
running = true;
try {
Display.setParent(display_parent);
//Display.setVSyncEnabled(true);
Display.create();
initGL();
} catch (LWJGLException e) {
e.printStackTrace();
}
gameLoop();
}
};
gameThread.start();
}

/**
* Tell game loop to stop running, after which the LWJGL Display will be destoryed.
* The main thread will wait for the Display.destroy() to complete
*/
private void stopLWJGL() {
running = false;
try {
gameThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void start() {
}
public void stop() {
}
/**
* Applet Destroy method will remove the canvas, before canvas is destroyed it will notify
* stopLWJGL() to stop main game loop and to destroy the Display
*/
public void destroy() {
remove(display_parent);
super.destroy();
System.out.println("Clear up");
}
/**
* initialise applet by adding a canvas to it, this canvas will start the LWJGL Display and game loop
* in another thread. It will also stop the game loop and destroy the display on canvas removal when
* applet is destroyed.
*/
public void init() {
setLayout(new BorderLayout());
try {
display_parent = new Canvas() {
public void addNotify() {
super.addNotify();
startLWJGL();
}
public void removeNotify() {
stopLWJGL();
super.removeNotify();
}
};
display_parent.setSize(getWidth(),getHeight());
add(display_parent);
display_parent.setFocusable(true);
display_parent.requestFocus();
display_parent.setIgnoreRepaint(true);
//setResizable(true);
setVisible(true);
} catch (Exception e) {
System.err.println(e);
throw new RuntimeException("Unable to create display");
}
}
public void gameLoop() {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
while(running) {
angle += 2.0f;
// draw the gears
drawLoop();
Display.update();
if (startTime > System.currentTimeMillis()) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println(fps + " frames 2 in " + timeUsed / 1000f + " seconds = "
+ (fps / (timeUsed / 1000f)));
fps = 0;
}
if (Mouse.isButtonDown(0)) {
if (!mouseButtonDown) {
prevMouseX = Mouse.getX();
prevMouseY= Mouse.getY();
}
mouseButtonDown = true;
}
else {
mouseButtonDown = false;
}
if (mouseButtonDown) {
int x = Mouse.getX();
int y = Mouse.getY();
float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)display_parent.getWidth());
float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)display_parent.getHeight());
prevMouseX = x;
prevMouseY = y;
view_rotx += thetaX;
view_roty += thetaY;
}
// F Key Pressed (i.e. released)
if (keyDown && !Keyboard.isKeyDown(Keyboard.KEY_F)) {
keyDown = false;
try {
if (Display.isFullscreen()) {
Display.setFullscreen(false);
}
else {
Display.setFullscreen(true);
}
} catch (LWJGLException e) {
e.printStackTrace();
}
}
}
Display.destroy();
}
public void drawLoop() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
glPushMatrix();
glTranslatef(-3.0f, -2.0f, 0.0f);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1f, -2.0f, 0.0f);
glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1f, 4.2f, 0.0f);
glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
protected void initGL() {
try {
// setup ogl
FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
pos.flip();
red.flip();
green.flip();
blue.flip();
glLight(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
glEndList();
glEnable(GL_NORMALIZE);
glMatrixMode(GL_PROJECTION);
System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName());
System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR));
System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER));
System.err.println("GL_VERSION: " + glGetString(GL_VERSION));
System.err.println();
System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix);
if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) {
// --- not using extensions
glLoadIdentity();
} else {
// --- using extensions
final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put(
new float[] { 1, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 0, 1});
identityTranspose.flip();
glLoadTransposeMatrixARB(identityTranspose);
}
float h = (float) display_parent.getHeight() / (float) display_parent.getWidth();
glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -40.0f);
} catch (Exception e) {
System.err.println(e);
running = false;
}
}
/**
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* @param inner_radius radius of hole at center
* @param outer_radius radius at center of teeth
* @param width width of gear
* @param teeth number of teeth
* @param tooth_depth depth of tooth
*/
private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
int i;
float r0, r1, r2;
float angle, da;
float u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
da = 2.0f * (float) Math.PI / teeth / 4.0f;
glShadeModel(GL_FLAT);
glNormal3f(0.0f, 0.0f, 1.0f);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
if (i < teeth) {
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da),
width * 0.5f);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f);
}
glEnd();
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f);
u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle);
v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle);
len = (float) Math.sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f);
glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f);
u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da);
v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da);
glNormal3f(v, -u, 0.0f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f);
glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f);
}
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f);
glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0f * (float) Math.PI / teeth;
glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f);
glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f);
}
glEnd();
}
}

[/source]

[b]UnembraWindow.html[/b]
[source]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>AppletLoader</title>
</head>
<body>
<applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar" codebase="." width="640" height="480">

<!-- The following tags are mandatory -->

<!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
<param name="al_title" value="appletloadertest2">

<!-- Main Applet Class -->
<param name="al_main" value="org.lwjgl.test.applet.UnembraGame">

<!-- List of Jars to add to classpath -->
<param name="al_jars" value="lwjgl_applet.jar, lwjgl.jar, jinput.jar, lwjgl_util.jar">

<!-- signed windows natives jar in a jar -->
<param name="al_windows" value="windows_natives.jar">

<!-- signed linux natives jar in a jar -->
<param name="al_linux" value="linux_natives.jar">

<!-- signed mac osx natives jar in a jar -->
<param name="al_mac" value="macosx_natives.jar">
<!-- signed solaris natives jar in a jar -->
<param name="al_solaris" value="solaris_natives.jar">

<!-- Tags under here are optional -->

<!-- whether to use cache - defaults to true -->
<!-- <param name="al_cache" value="true"> -->

<!-- Version of Applet (case insensitive String), applet files not redownloaded if same version already in cache -->
<!-- <param name="al_version" value="0.1"> -->

<!-- Specify the minimum JRE version required by your applet, defaults to "1.5" -->
<!-- <param name="al_min_jre" value="1.6"> -->

<!-- background color to paint with, defaults to white -->
<!-- <param name="boxbgcolor" value="#000000"> -->

<!-- foreground color to paint with, defaults to black -->
<!-- <param name="boxfgcolor" value="#ffffff"> -->

<!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
<!-- <param name="al_logo" value="appletlogo.gif"> -->

<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
<!-- <param name="al_progressbar" value="appletprogress.gif"> -->

<!-- whether to run in debug mode -->
<!-- <param name="al_debug" value="true"> -->

<!-- whether to prepend host to cache path - defaults to true -->
<!-- <param name="al_prepend_host" value="true"> -->

<param name="separate_jvm" value="true">
</applet>
<p>
if <code>al_debug</code> is true the applet will load and extract resources with a delay, to be able to see the loader process.
</p>
</body>
</html>

[/source]

I realize the problem states: Java.lang.ClassNotFoundException: UnembraGame, but I can't seem to figure out why it can't find it... the game will compile and run fine in eclipse juno, but it throws this exception when trying to run it in chrome/firefox.

I also did an export in eclipse and created a jar file that has the following set up:

[b]UnembraGame.jar[/b]
[source]
+ META-INF
MANIFEST.MF
UnembraGame.java
UnembraGame.class
UnembraGame$2.class
UnembraGame$1.class
.project
.classpath
[/source]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this