1

I know there are a lot of theese questions but when I do one of theese html applets like: <applet code=JavaGame.class archive="JavaGame.jar" width=120 height=120> </applet>

It throws me an error like this one: JavaGame(Wrong name: javagame/JavaGame)

I have more than one class my main class looks like this:

public class JavaGame{...}


static boolean leva = false;
static boolean prava = false;
static boolean horni = false;
static boolean dolni = false;

public static void main(String[] args) {....}

I have tried the following:

extends Applet in the main class (It just showed blank screen nothing else) public class javagame.JavaGame (It also dint work it just showed blank screen nothing else)

it cant be the error in the main class because it works normally on its own without any html tag.

can anyone please help me I have all the neccesary files in a folder with the html file thanks.

  • 1
    Duplicate of [Java applet Error ... What is wrong?](http://stackoverflow.com/questions/6009767/java-applet-error-what-is-wrong) (as far as we can tell with the amount of information provided). – T.J. Crowder Aug 16 '13 at 16:25
  • I tried it it still dosent work :/ is this because of Java 7 or am I just being stupid here – Samuel Kodytek Aug 16 '13 at 16:29
  • 1
    @SamuelKodytek Share with us what you have tried – boxed__l Aug 16 '13 at 16:33
  • 1
    @SamuelKodytek: Show us what you've tried, and also show us the structure of the jar. The question at the moment cannot be usefully answered, there's not nearly enough information. – T.J. Crowder Aug 16 '13 at 16:34
  • Basicly I have more then one classes the main class is JavaGame.class more in the questio I will edit it – Samuel Kodytek Aug 16 '13 at 16:40

1 Answers1

0
Wrong name: javagame/JavaGame 

That suggests the JavaGame class is in

package javagame; 

If that is correct, then code=JavaGame.class (the file name) in the applet element in HTML should be code='javagame.JavaGame' (the fully qualified class name - which includes the package).

<applet 
  code='javagame.JavaGame'
  archive="JavaGame.jar"
  width=120 height=120> 
</applet>
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433