Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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  
  I cannot get my applet to work because of package  (Read 1888 times)
0 Members and 1 Guest are viewing this topic.
Offline h3ckboy

JGO Coder


Medals: 5



« Posted 2010-01-05 10:55:13 »

well, as the title says, I am unable to get my applet ot show on a webpage because it is in a package, or atleast that is the only reason I can come up with.

I have bashed my head against this for days, trying hte find the way to do it, ub tI have been unsuccesful. so I though "maybe JGO will know the answer" so I am asking.

my jar is an attachment, and the main class is located at main\Main.class.

so how would you make the applet code for this?(imbedding in webpage).

thx in advance,
h3ckboy
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #1 - Posted 2010-01-05 11:17:24 »

I get this when I open the console :

java.lang.NoClassDefFoundError: main/states/MenuState


and when I opened your jar I couldn't find that class. Are you sure the jar was correctly generated ?

Offline indexunknown

Junior Devvie





« Reply #2 - Posted 2010-01-05 11:18:20 »

maybe try <applet ...  codebase="main"  .../>
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #3 - Posted 2010-01-05 11:24:18 »

I get this when I open the console :

java.lang.NoClassDefFoundError: main/states/MenuState


and when I opened your jar I couldn't find that class. Are you sure the jar was correctly generated ?

well, since it is an applet, there isnt supposed to be a main class.... there is just a class that extends applet.

and I think it was generate correctly, because I used eclipse to do it.
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #4 - Posted 2010-01-05 11:28:55 »

I think he's complaining about a class that was supposed to be in the jar, but it's not . Dont u have a class named MenuState in your project ? if you have, it is not in the jar .

Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #5 - Posted 2010-01-05 11:33:30 »

By the way, that's the code of my applet : (and yes it starts loading but I get this error with the missing MenuState class )

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 10] 10.2 Applets</TITLE>
</HEAD>
<body>
pompom
<center><applet code="main.Main.class" archive="tankdefence.jar" CODEBASE="." width=326 height=457></applet>
</center>
</body>
</html>

Offline h3ckboy

JGO Coder


Medals: 5



« Reply #6 - Posted 2010-01-05 12:59:32 »

yeah, for some reason menustate isnt in the jar....

I will try re-jaring it.

EDIT:
I get this when I tried your code
1  
2  
3  
4  
5  
6  
java.lang.NullPointerException
   at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
   at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException


thx in advance,
h3ckboy

EDIT2:
well turns out it is all eclipse's fault, I didnt check with compiler warning, so a lot of my classes were missing.

I got it fixed now!

thx
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.

Elsealabs (15 views)
2014-12-28 10:39:27

CopyableCougar4 (19 views)
2014-12-28 02:10:29

BurntPizza (24 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

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

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

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

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!