0

I know this has been asked multiple times already, and I have already tried to use all of the solutions that I could find, but I wasn't able to get any success. I have a JApplet that works successfully (I've pasted the heirarchy below, as I don't think the code itself is relevant to the issue. I might be wrong). I also have some basic HTML code that seems to be correct based on the solutions that I have found. The problem is that I continue to get the same error:

error
(source: gyazo.com)

And I'm not sure why I'm getting it. Is it because everything in the heirarchy is a .java file?

my HTML file:

<html>
    <head></head>
        <body>
            <applet width="950" height="600" archive="test.jar" code="OneQuestMapgen.OneQuestMapgen.class"></applet>
        </body>
</html>

Hierarchy:

hierarchy

Files:

files

Any help would be appreciated. Thanks so much!

Community
  • 1
  • 1
Vasu
  • 1,090
  • 3
  • 18
  • 35
  • Does your error message still exists if you fix your document structure? A closing and is missing. – Reporter Jun 05 '13 at 13:10
  • I think you need to put all the classes in a package (rather than a default package) - Just a guess. – asifsid88 Jun 05 '13 at 13:13
  • Yes, I'm still having the same issue. Thanks for pointing that out though. I've fixed it and added the and

    , but I'm still getting the exact same error.

    – Vasu Jun 05 '13 at 13:14
  • You're missing the package qualifier for your class - see Ketans answer below – Reimeus Jun 05 '13 at 13:16
  • I've fixed the html as specified below, but I'm still having an issue (albeit a different one now, as updated in the original post). I'm having a security issue; the program won't run because it is saying the security settings are wrong/invalid. – Vasu Jun 05 '13 at 19:27

4 Answers4

1

First, you need to close you <head> tag with </head> and do the same with the <body> tag.

Also, the <applet> tag has been deprecated in HTML4.01 and is not allowed in HTML5, so you should replace for <object> tag

So, if you are using it on Chrome, for instance. It will NOT work.

joaonlima
  • 618
  • 5
  • 15
  • Ah, thanks for pointing the out. However, the applet is still running (albeit incorrectly), so I'm assuming it is still allowed? o_o. – Vasu Jun 05 '13 at 19:29
1

Can you try..

<applet width="950" height="600" archive="test.jar" code="OneQuestMapgen.OneQuestMapgen.class">
Ketan Bhavsar
  • 5,338
  • 9
  • 38
  • 69
  • *`code="OneQuestMapgen.OneQuestMapgen.class"`* If it were a relative path it would be `OneQuestMapgen/OneQuestMapgen.class`. The fully qualified name (FQN) would be `OneQuestMapgen.OneQuestMapgen`. The `code` attribute should be the FQN. – Andrew Thompson Jun 05 '13 at 13:54
  • This code works for the applet tag and it has resolved my primary issue, however I am still getting a security setting issue. – Vasu Jun 05 '13 at 19:28
  • This looks like browser settings. You check your browser settings and down the security. – Ketan Bhavsar Jun 06 '13 at 08:08
0

If your applet is in the same dir. as the html file you don't need to specify it as the browser searches for a location of the document in the same dir, if you have it elsewhere then it's ok to have the archive which should containt the path to the jar file.

Beside that you should consider adding to the code attribute also the package in which your class resideds, all separated by a dot code="OneQuestMapgen.OneQuestMapgen.class"

Lucian Enache
  • 2,510
  • 5
  • 34
  • 59
0

Shouldn't your html be like this?

<html>
<head></head> <!-- closing the head before the body -->
<body>
  <applet width="950" height="600" code="OneQuestMapgen.OneQuestMapgen.class" 
    type="application/x-java-applet;jpi-version=6" 
    archive="test.jar">
</body>
</html>

in html5 it should be something like

<object type="application/x-java-applet" height="600" width="950">
  <param name="code" value="OneQuestMapgen.OneQuestMapgen.class" />
  <param name="archive" value="test.jar" />
  Applet failed to run.  No Java plug-in was found.
</object>
fGo
  • 1,146
  • 5
  • 11
  • *`code="OneQuestMapgen.OneQuestMapgen.class"`* If it were a relative path it would be `OneQuestMapgen/OneQuestMapgen.class`. The fully qualified name (FQN) would be `OneQuestMapgen.OneQuestMapgen`. The `code` attribute should be the FQN. – Andrew Thompson Jun 05 '13 at 13:55