Box2D Forums

It is currently Sun May 19, 2013 4:38 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to deploy an applet?
PostPosted: Fri Mar 27, 2009 10:39 am 
Offline

Joined: Fri Mar 27, 2009 10:03 am
Posts: 6
I can build an run a JBox2D game locally.
But I cannot make the applet run on a remote (Microsoft) server.
I don't how to organize the files on the server.
My applet tag looks like this:
<applet name="PApplet" archive="core.jar, jbox2d.jar" code="MyApplet.class" width="500" height="500" mayscript="true">

plus the same parameters as here:
http://www.jbox2d.org/demos/motorsandlimits.html

I can upload and execute a simple applet without extra jars.


Top
 Profile  
 
PostPosted: Fri Mar 27, 2009 2:34 pm 
Offline

Joined: Sun Sep 23, 2007 2:35 pm
Posts: 803
I'm not sure about the
Code:
code="MyApplet.class"
piece - the code from my applet (the one you linked) looks like this:

Code:
<applet
 name="PApplet"
 code="testbed.tests.MotorsAndLimits"
 archive="core.jar,Pendulum.jar"
 width="500" height="500"
 mayscript="true">


The code parameter should point to the fully qualified class name that has your main method; I'm not sure if it's allowed to point at the .class object.

But to be honest I don't know if that's your problem - I don't actually know anything about this stuff, I usually just start with something that I know works and modify it as needed to swap out the moving parts. Applets are generally a big stinky mess that I have neither the patience nor the inclination to fully understand. :)

Couple other things that might help figure it out: what happens when you go to the page you've created? Do you get an error in the Java console, or something else? Also, are you sure all the files are in the right places on the server?


Top
 Profile  
 
PostPosted: Mon Mar 30, 2009 5:06 am 
Offline

Joined: Fri Mar 27, 2009 10:03 am
Posts: 6
My "problem" is that the applet now runs fine with the original files untouched.
However, it does not work if I recompile TestbedMain.java and replace TestbedMain.class in the jbox2d.jar file. I just use plain javac and jar in a command window under Windows XP. And then ftp. I have examined the contents of the jar file and only the timestamp of the class has changed. As it Ok to use Java 1.6 or do I need to switch back to 1.5?
I get java.lang.ClassNotFoundException: org.jbox2d.testbed.TestbedMain
Since the source code has not changed, could it be a security problem?
Does the jar file need to be signed or something?


Top
 Profile  
 
PostPosted: Mon Mar 30, 2009 3:09 pm 
Offline

Joined: Sun Sep 23, 2007 2:35 pm
Posts: 803
Hmm, I'm not exactly sure what's going on then. You might need to compile against Java 1.5 if you're just dropping in a new TestbedMain.class - I'm pretty sure I used 1.5, and I don't know if the JVM supports using different targets within a single .jar (it could, I've never tried). That said, your error doesn't sound like a version error.

How are you re-creating the .jar file? I'd wonder if maybe something is going wrong there and the new .class is not showing up in the manifest or something like that?

I always compile everything together from Eclipse (command line can get real irritating with Java), so I'm not sure what might go wrong if you're trying to recreate just a single class file...you may want to ask around on a Java forum to see if anyone knows, I'm afraid I might be out of ideas. :)


Top
 Profile  
 
PostPosted: Tue Mar 31, 2009 6:09 am 
Offline

Joined: Fri Mar 27, 2009 10:03 am
Posts: 6
In 2003 I was actually teaching Java and I also became a "Certified Java Programmer".
I that time everything was so simple. Then I worked with other things, like Microsoft software, Mobile phones, etc. What is going on the software business? I don't like it. What is the point of makings things so complex that nothings works anymore? We had similar problems at several large companies. Thousands of people were struggling with bad tools and poor documentation.

Just to simplify my current problem, I made a jar file with a single java applet class but it still doesn't work. Some suggested that I should use the <object> tag instead <applet>.
If that is the case, I will drop the idea of using Java in an Applet for the web.
I will drop the idea of publishing something with Box2D on the web. I dropped Flash for similar reasons. So, from now on, I will concentrate on C#, which seems to be easy. I had a nice working simulation in C++ earlier. I want to concentrate on the 'physics', nothing else, and certainly not on security issues.

But my first impression of the C# version was that there was no 'torque' property for the 'joints'. That is what I am going to investigate now ...

To answer your question on how I created the jar file. I did not create the jar file from scratch.
I just replaced TestbedMain.class in the downloaded jar file with the class I compiled myself.
The command line tool jar.exe can remove and add items to a jar file. I did not change the simple 2-line manifest inside the jar file.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group