Reputation: 72
I know that the question has been asked many times, but I have problem that I could not solve normaly. I am codeing a RPG game and I would to run in self-standing in browser. the DIR looks like:
C:\Users\Tomasz\SimpleRPG
that is main folder of project, but I have here .settings
bin
and src
folders, and in each i have package foldes rpg
.
I have found code to run it from HTML:
<applet code=main.class name=main archive=main.jar
width=640 height=640>
<param name="bgcolor" value="ffffff">
<param name="fontcolor" value="000000">
Your browser is not Java enabled.
</applet>
I am wondering where to put that file to run it. When I drop it to bin/rpg
, it brings me error:
NoClassDefFoundError: main (wrong name: rpg/main)
If I drop it to src/rpg
I have another error:
ClassNotFoundException: main.class
And if I copy all .class
and all .java
to one folder SimpleRPG/all
and drop script there:
NoClassDefFoundError: main (wrong name: rpg/main)
I have to say that I have also graphics in that project in bin/img
.
Can some one advise me what to do?
Upvotes: 0
Views: 122
Reputation: 168825
It seems the class file is located in the rpg
package. So the applet element should be more along the lines of:
<applet code='rpg.main'
name='main'
archive='main.jar'
width='640' height='640'>
<param name="bgcolor" value="ffffff">
<param name="fontcolor" value="000000">
Your browser is not Java enabled.
</applet>
This should work if main.jar
is in the same directory as the HTML that loads it.
Upvotes: 1