Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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  
  Applet runs in eclipse but not in browser  (Read 1516 times)
0 Members and 1 Guest are viewing this topic.
Offline roland
« Posted 2009-10-21 09:06:07 »

Hi, my applet runs fine in Eclipse Applet viewer. I don't know what I did but it doesnt run in my browser any more.
When I open it it says class not found: + heaps more the same
eg:

java.lang.NoClassDefFoundError: Main$1
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at sun.applet.AppletPanel.createApplet(Unknown Source)
   at sun.plugin.AppletViewer.createApplet(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)

I have a class called main and for some reason Eclipse is building extra class files like Main$1 and Main$2 which I don't need and I think part of my main class is being built in them. Thats why I think its not working. But I have no idea how to fix it.
thanks for help,
roland
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #1 - Posted 2009-10-21 09:53:09 »

Those are compiled inner classes.

For example:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public class Foo {
    public class Bar {
        // Inner class. Gets compiled as Foo$1.class
    }

    public Object o = new Object() {
        // Anonymous inner class. Gets compiled as Foo$2.class
        public String toString() {
            return "overridden toString()!";
        }
    };
}


If o was inside Bar, it (or rather, its class) would get compiled as Foo$1$1.class

So you've got an inner class somewhere inside Main. Make sure you copy all the class files when deploying the applet.

Play Minecraft!
Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #2 - Posted 2009-10-21 11:14:38 »

Almost correct Markus  Grin

The numbered inner classes are used only for Anonymous inner classes.
In your example you get Foo.class, Foo$Bar.class and Foo$1.class.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #3 - Posted 2009-10-21 11:16:45 »

I was not aware of that! Thanks. =)

Play Minecraft!
Offline roland
« Reply #4 - Posted 2009-10-22 08:28:02 »

thanks  Smiley

now I found out that because I'm using ImageIO I can't load images in my browser without signing my applet. So I tried to follow the instructions from here:

http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=149518

when it asked for a password first I tried nothing, then tried changeit because that's what I searched for online. Here is my results.


keytool -genkey -alias RolandsJavaKey
Enter keystore password:
Keystore password is too short - must be at least 6 characters
Enter keystore password:
keytool error: java.io.IOException: Keystore was tampered with, or password was
incorrect

does anyone know what the problem is? is it the keystore or the password?
Offline pjt33
« Reply #5 - Posted 2009-10-22 09:13:27 »

Almost correct Markus  Grin

The numbered inner classes are used only for Anonymous inner classes.
In your example you get Foo.class, Foo$Bar.class and Foo$1.class.
What happened to using + instead of $ for anonymous ones in 1.5? Was that ditched in 1.6? Or did it get ditched between -ea and final 1.5?
Offline roland
« Reply #6 - Posted 2009-10-22 09:23:12 »

I finally figured out how to create a signed jar by creating a new key store.
I think I'm close to getting this working.
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.

theagentd (20 views)
2014-10-25 15:46:29

Longarmx (53 views)
2014-10-17 03:59:02

Norakomi (47 views)
2014-10-16 15:22:06

Norakomi (35 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (69 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (46 views)
2014-10-11 23:10:45
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!