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!

5
  • Does your error message still exists if you fix your document structure? A closing <head> and <body> is missing. Commented Jun 5, 2013 at 13:10
  • I think you need to put all the classes in a package (rather than a default package) - Just a guess. Commented Jun 5, 2013 at 13:13
  • Yes, I'm still having the same issue. Thanks for pointing that out though. I've fixed it and added the </head> and </body>, but I'm still getting the exact same error. Commented Jun 5, 2013 at 13:14
  • You're missing the package qualifier for your class - see Ketans answer below Commented Jun 5, 2013 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. Commented Jun 5, 2013 at 19:27

4 Answers 4

1

Can you try..

<applet width="950" height="600" archive="test.jar" code="OneQuestMapgen.OneQuestMapgen.class">
Sign up to request clarification or add additional context in comments.

3 Comments

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.
This code works for the applet tag and it has resolved my primary issue, however I am still getting a security setting issue.
This looks like browser settings. You check your browser settings and down the security.
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.

1 Comment

Ah, thanks for pointing the <head></head> out. However, the applet is still running (albeit incorrectly), so I'm assuming it is still allowed? o_o.
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"

Comments

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>

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.