Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Many 4k applets not working  (Read 4844 times)
0 Members and 1 Guest are viewing this topic.
Offline delt0r

JGO Knight


Medals: 30
Exp: 18 years


Computers can do that?


« Posted 2009-12-31 11:47:38 »

Quite a few... ok most of the current 4k entrys on the 4k page do not work for me. They all fail with a class not found exception:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
./jdk1.6.0_13/bin/appletviewer "http://java4k.com/index.php?action=games&method=view&gid=282"
load: class k.class not found.
java.lang.ClassNotFoundException: k.class
        at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:210)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:143)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:690)
        at sun.applet.AppletPanel.createApplet(AppletPanel.java:785)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
        at sun.applet.AppletPanel.run(AppletPanel.java:368)
        at java.lang.Thread.run(Thread.java:619)


Example of ones that work is BoxBot4k, and ones that don't work are Maze4k and FortressFall4k and GTA4k (but that worked from the devs page).

I am on linux (slackware) and is dose not matter if we are in a browser or using an appletviewer, it either works in both or neither (java 1.6u13 64bit).  I first noticed the problem in fish4k and there is a post or 2 on the matter in that thread.  Would be nice to resolve the issue.

Cheers

I have no special talents. I am only passionately curious.--Albert Einstein
Offline steveyO
« Reply #1 - Posted 2009-12-31 12:27:53 »

Strange!! They all work fine on my laptop (Windows,  jdk1.6)..

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Offline moogie

JGO Ninja


Medals: 15
Projects: 6
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2009-12-31 12:39:03 »

sounds like a client side pack200 issue to me...

I wonder if Appel has set up his web server to send back "normal" JAR versions if the pack200 versions are not accepted by the client.. this may sove delt0r's problems.

Java4k RIP 2014
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline appel

JGO Wizard


Medals: 68
Projects: 4


I always win!


« Reply #3 - Posted 2009-12-31 16:54:31 »

AlanW notified me of this earlier.

No, the web server doesn't send back a normal JAR if pack200 isn't accepted by the client. I would have thought anyone with JRE 1.5 and up would be able to run pack200?

I was hoping pack200 would work seamlessly, but Sun never disappoints me in their failures on the end-user front.

Ok, won't be able to look at this until tomorrow... new years eve and all.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #4 - Posted 2009-12-31 17:44:38 »

As Appel noted, I had the same issue with OSX 10.4 with Java 1.5.0 with both Safari & Firefox.  No problems with Windows + Java 1.6.  I loaded a pack.gz on my own Tomcat server along with an empty jar (needed by the server code, but obviously the jar contains no code).  This worked Ok on the Mac, so the problem most likely relates to headers or file names.  I also wondered whether folks had created java 1.6 format pack200's by mistake, but if delt0r is having trouble even with java 1.6, that seems less likely.

Time flies like a bird. Fruit flies like a banana.
Offline halfwitgoat

Junior Devvie


Projects: 2



« Reply #5 - Posted 2010-01-02 12:12:06 »

I've had problems with the Pack200 applets, but it's specific to Opera. They all work fine in IE and Firefox.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
-- Opera - Java Console --

Java vendor: Sun Microsystems Inc.
Java version: 1.6.0_17

type 'h' for help

--
java.lang.ClassNotFoundException: a
   at com.opera.AppletClassLoader.findClass(AppletClassLoader.java:369)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at com.opera.AppletClassLoader.loadClass(AppletClassLoader.java:433)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at com.opera.AppletPanel.runLoaderThread(AppletPanel.java:410)
   at com.opera.AppletPanel.run(AppletPanel.java:384)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: HTTP Connection failed.
   at com.opera.AppletClassLoader.readClassFile(AppletClassLoader.java:378)
   at com.opera.AppletClassLoader.access$100(AppletClassLoader.java:34)
   at com.opera.AppletClassLoader$4.run(AppletClassLoader.java:360)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.opera.AppletClassLoader.findClass(AppletClassLoader.java:358)
   ... 6 more

Offline steveyO
« Reply #6 - Posted 2010-01-29 12:09:26 »

Am currently on my hols in the UK (at a mates house) and none of the games on the java4k website work here (same exception as above).
Running JRE 1.6.   
My 4K game works on my personal site (similar applet code),  so maybe the reason is that I have the .jar version on my webserver too (aswell as the .jar.gz) and the java4k only has the.jar.gz version...  Dunno just a guess.

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #7 - Posted 2010-01-29 15:25:24 »

Am currently on my hols in the UK (at a mates house) and none of the games on the java4k website work here (same exception as above).
Running JRE 1.6.   
My 4K game works on my personal site (similar applet code),  so maybe the reason is that I have the .jar version on my webserver too (aswell as the .jar.gz) and the java4k only has the.jar.gz version...  Dunno just a guess.

Which browser?

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline JoC

Junior Devvie




I love YaBB 1G - SP1!


« Reply #8 - Posted 2010-01-29 15:41:00 »

Same here, most 4k applets gives java.lang.ClassNotFoundException:

MacOSx 10.5.8, Safari 4.04
Tried with both Java 1.6.0_17, 64 bit and Java 1.5.0_22, 32bit
Offline steveyO
« Reply #9 - Posted 2010-01-29 17:41:24 »

Quote
Which browser?
Firefox (3.0.17), but wouldn't have thought this was the issue..  I dont know much about pack2000 but if the client cannot unpack the .jar.gz file does it not ask the server for the .jar file instead?  In which case should'nt the java4k server have both the .jar.gz and the .jar file?  When I submitted my game it only asked me to upload the .jar.gz file.  Maybe if appel can extract one of the .jar files from a .gz file on the java4k server I can test whilst am still here (2 more days) to see if this is the issue.

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #10 - Posted 2010-01-29 19:05:57 »

Firefox (3.0.17), but wouldn't have thought this was the issue..  I dont know much about pack2000 but if the client cannot unpack the .jar.gz file does it not ask the server for the .jar file instead?  In which case should'nt the java4k server have both the .jar.gz and the .jar file?  When I submitted my game it only asked me to upload the .jar.gz file.  Maybe if appel can extract one of the .jar files from a .gz file on the java4k server I can test whilst am still here (2 more days) to see if this is the issue.

I think the point is, no clients should be asking for the .jar file.
Either the client is pre-1.5 and so cannot run the application anyway, or they are 1.5+ and so should be able to handle the pack200 gzip.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 840
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2010-01-29 19:10:42 »

I think the point is, no clients should be asking for the .jar file.

Actually, it's the other way around:

The client MUST request a *.jar WITH Accept-Encoding: pack200-gzip
The server will responds with a *.jar.pack.gz file, passing Content-Encoding: pack200-gzip.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #12 - Posted 2010-01-29 20:38:08 »

I've been looking at the java jnlp servlet code, which successfully downloads pack200 on my mac with Java 1.5.  The codes a bit convoluted, but I think I've extracted the key bits and converted them into non-java pseudo-code.  It does this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
// On receiving a request work out what to send
File FindResource(Path, MimeType, Encoding) {

  // Check for Pack200

  if (MimeType == "application/x-java-archive" OR
      MimeType == "application/java-archive") AND
      Encoding.toLowerCase().contains( "pack200-gzip") then
    if exists(path+".pack.gz") // Actually datestamp check
      return getResource(path+".pack.gz")
  EndIf

  // Check for Gzip
  if Encoding.toLowerCase().contains("gzip") then
    if exists(path+".gz")
      return getResource(path+".gz")
  EndIf

  // No compression
  if exists(path)
    return getResource(path)

  // Not Found
  return null
}


// Select Content encoding for transmission with the file we are sending
Content-Encoding GetEncoding(file) {

  // Pack200
  if file.getName.endsWith(".pack.gz") then
    return "pack200-gzip"

  // Gzip
  if file.getName.endsWith(".gz") then
    return "gzip"

  return null
}


Edit: updated with "contains()" to make it clear we are checking for a substring

Time flies like a bird. Fruit flies like a banana.
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #13 - Posted 2010-01-29 20:52:34 »

Actually, it's the other way around:

The client MUST request a *.jar WITH Accept-Encoding: pack200-gzip
The server will responds with a *.jar.pack.gz file, passing Content-Encoding: pack200-gzip.

Sorry, poorly phrased on my part  Roll Eyes
I take it the premise of what should happen is still correct though?

<1.5 "I'll have this jar please."
>=1.5 "I'll have this jar please, though a pack200-gzip would be super-smashing-great too!"

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline moogie

JGO Ninja


Medals: 15
Projects: 6
Exp: 10 years


Java games rock!


« Reply #14 - Posted 2010-01-29 22:32:06 »

To make the user experience better... perhaps java4k should only send the JAR and not the pack.gz version no matter what the client says...

The pack.gz is there to qualify as meeting the 4k limit... only the judges care, the general user does not really care...

Java4k RIP 2014
Offline Gudradain
« Reply #15 - Posted 2010-01-30 04:24:32 »

We could also just send a .zip file that is below 4k with a .jar that might be over 4k... But we lost all the fun of the compression trick.
Offline pjt33
« Reply #16 - Posted 2010-01-30 10:42:41 »

No, the web server doesn't send back a normal JAR if pack200 isn't accepted by the client. I would have thought anyone with JRE 1.5 and up would be able to run pack200?

I was hoping pack200 would work seamlessly, but Sun never disappoints me in their failures on the end-user front.
Yep, this is spectacular fail on Sun's part.

Taking the example link (Kuest), it works fine with the Java plugin in Firefox, but appletviewer (same version of Java, same machine) doesn't work. Sniffing with wireshark, I see that appletviewer makes the following series of requests:

1  
2  
3  
/applet.php?gid=282 (server replies with pack200-gzip'd file)
/k.class (server replies with 404)
/k/class.class (server replies with 404)

and then gives up.

But get this: on all three requests, appletviewer sends the following header:
1  
2  
3  
4  
5  
6  
7  
User-Agent: Java(tm) 2 SDK, Standard Edition v1.6.0_0 Java/1.6.0_0

Host: java4k.com

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: keep-alive

It's trying to download a class or jar, and it claims to prefer the server to reply with HTML pages and images.

The critical point is that there's no Accept-Encoding header at all.

BTW, despite the User-Agent this is 1.6.0_15.
Offline steveyO
« Reply #17 - Posted 2010-01-30 14:40:06 »

Ok, Still confused.. As mentioned am running JRE 1.6 at mates house, so why isnt the pack2000 stuff working, or does it only work if you have the JDK installed? 
Kuest, when run from my own website works here (See below) but not the java4k version. I seem to remember it not working if the Kuest.jar file was not on the server (unfortunately not got putty here so can't test for certain this is the case).

Quote
      <applet archive="Kuest.jar.gz" code="k.class"   width="800" height="550">
        <PARAM NAME="java_arguments" VALUE="-Djnlp.packEnabled=true" />
                  <PARAM NAME="cache_archive" VALUE="Kuest.jar" />
      </applet>

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Online kappa
« League of Dukes »

JGO Kernel


Medals: 80
Projects: 15


★★★★★


« Reply #18 - Posted 2010-01-30 14:52:40 »

Ok, Still confused.. As mentioned am running JRE 1.6 at mates house, so why isnt the pack2000 stuff working, or does it only work if you have the JDK installed? 
Kuest, when run from my own website works here (See below) but not the java4k version. I seem to remember it not working if the Kuest.jar file was not on the server (unfortunately not got putty here so can't test for certain this is the case).


In the cache archive parameter you have to omit the extension part (.jar bit)
1  
2  
3  
4  
<applet archive="Kuest.jar.gz" code="k.class"   width="800" height="550">
        <PARAM NAME="java_arguments" VALUE="-Djnlp.packEnabled=true" />
                  <PARAM NAME="cache_archive" VALUE="Kuest" />
      </applet>

Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #19 - Posted 2010-01-30 20:05:29 »

Quote
<PARAM NAME="java_arguments" VALUE="-Djnlp.packEnabled=true" />
JNLP for applets only came in with plugin2 (which means Java 1.6u10+).
The code on Java4k isn't friendly to the original plug in so Java 1.5 causes problems.

I know that pack200 does work on Java 1.5 on my Mac, because I tested it using Tomcat and the jnlpdownloadservlet.  I would note that there are two valid mime types for java archives and Accept Encoding may arrive in upper or lowercase (or maybe even mixed case) - conclusion reached after reading servlet code.  I also noted that the servlet code trims off any whitespace from the file name before appending .pack.gz.  Could be the problems in the implementation detail on Java4k.

Time flies like a bird. Fruit flies like a banana.
Offline pjt33
« Reply #20 - Posted 2010-01-30 21:38:01 »

JNLP for applets only came in with plugin2 (which means Java 1.6u10+).
The code on Java4k isn't friendly to the original plug in so Java 1.5 causes problems.

I know that pack200 does work on Java 1.5 on my Mac, because I tested it using Tomcat and the jnlpdownloadservlet.  I would note that there are two valid mime types for java archives and Accept Encoding may arrive in upper or lowercase (or maybe even mixed case) - conclusion reached after reading servlet code.  I also noted that the servlet code trims off any whitespace from the file name before appending .pack.gz.  Could be the problems in the implementation detail on Java4k.
I'm pretty sure that the results I post above show that the problem is at least partly client-side and post-plugin2.
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #21 - Posted 2010-01-31 00:15:01 »

I'm pretty sure that the results I post above show that the problem is at least partly client-side and post-plugin2.
I did see you comments on AppletViewer, a somewhat flaky app in my opinion -  It doesn't meet spec on when the init() and start() methods are called w.r.t. window creation -  and so am not entirely surprised that it doesn't set Accept Encoding correctly.  However I'm fairly certain the plugins do set it.

Edit: Note Accept and Accept-Encoding header fields are different!

1  
2  
3  
4  
5  
6  
7  
GET /applets/applet-5.7.0.2.jar HTTP/1.1
content-type: application/x-java-archive
accept-encoding: pack200-gzip,gzip
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/4.0 (Windows XP 5.1) Java/1.6.0_03
Accept: text/html, image/gif, image/jpeg, ; q=.2, /; q=.2


Also need to check substring in Accept-Encoding as different browsers will send different things in the comma separated list.  servelet does:

1  
encoding.toLowerCase().indexOf(PACK200_GZIP_ENCODING) > -1){


Silly Question: Does Appletviewer support pack200? [After testing - coming to conclusion it does not]

Time flies like a bird. Fruit flies like a banana.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (28 views)
2014-12-15 09:26:44

Mr.CodeIt (19 views)
2014-12-14 19:50:38

BurntPizza (35 views)
2014-12-09 22:41:13

BurntPizza (70 views)
2014-12-08 04:46:31

JscottyBieshaar (32 views)
2014-12-05 12:39:02

SHC (44 views)
2014-12-03 16:27:13

CopyableCougar4 (40 views)
2014-11-29 21:32:03

toopeicgaming1999 (108 views)
2014-11-26 15:22:04

toopeicgaming1999 (94 views)
2014-11-26 15:20:36

toopeicgaming1999 (29 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!