I wrote a simple java applet in NetBeans and am having real trouble getting it embedded. I take my class file and copy that to the same directory as my html page. I also put my .jar there. On the html page I do
<applet code="ServerStatus.class" width="200" height="200">
Your browser does not support the <code>applet</code> tag.
</applet>
But the applet never loads. The first bit of the long error is:
load: class ServerStatusChecker.jar not found.
java.lang.ClassNotFoundException: ServerStatusChecker.jar
What do I have to do to embed this applet? The top of my MyApplet.java file is
package org.me.serverstatuschecker;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
public class MyApplet extends Applet implements ActionListener {
My ServerStatusChecker.jar is in the same place as the html file im trying to include it in. Inside the jar i have folders org/me/serverstatuschecker/MyApplet.class.
EDIT:
The full error message is as follows:
Java Plug-in 1.6.0_31
Using JRE version 1.6.0_31-b05 Java HotSpot(TM) Client VM
----------------------------------------------------
java.lang.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(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.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
java.lang.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(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.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
java.lang.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(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.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
java.lang.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(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.UnsupportedClassVersionError: org/me/serverstatuschecker/ServerStatusChecker : Unsupported major.minor version 51.0
Directory Structure
theappletdir/
applet.html
ServerStatusChecker.jar
Content of applet.html
Then use the script supplied by Oracle to deploy applets and JWS apps. It is called deployJava.js and linked from the applet info. page. It will:
Check the minimum stated JRE version is available for use by applets.
If not, help the user to upgrade it.
Embed & run the applet.
<html>
<head>
<!-- ... -->
<script src="http://www.java.com/js/deployJava.js"></script>
</head>
<body>
<!-- ... -->
<script>
var attributes = {codebase:'.',
code:'org.me.serverstatuschecker.MyApplet',
archive:'ServerStatusChecker.jar',
width:200, height:200};
var parameters = {};
var version = '1.6'; // or whatever version the code was compiled for
deployJava.runApplet(attributes, parameters, version);
</script>
</body>
</html>
New Error
UnsupportedClassVersionError: org/me/serverstatuschecker/MyApplet :
Unsupported major.minor version 51.0
When I refer to the version number list it indicates the code is being compiled compatible for a 1.7 JRE, whereas the version attribute above indicates the code should be able to be loaded in any 1.6+ JRE. The best way to fix this is to use the source, target bootclasspath options when compiling the code. Specify the first 2 as 1.6 and the last as a path to a 1.6 version rt.jar.
Have you tried the HtmlConverter Tool?
http://java.sun.com/products/plugin/1.3/docs/htmlconv.html
It creates a HTML code that tries to load your applet properly with the Java Plugin.
Related
I am using netbeans IDE.I have imported a animation.jar in my project for better gui experience,if i execute it in netbeans,it works fine.But, after i compiled and build the project.I copied the dist folder to desktop and run my project the animation is no longer running please help me,thanks in advance,sorry for bad english.
this are the errors sir after i convert it to .exe app using launch4j. I bundled it in jre6..in jre1.8 ir latest jre the problem is the my switching icons are not working..
Executing: C:\Users\syracuse\Desktop\dist\Alumni.exe
Exception in thread "main" java.lang.UnsupportedClassVersionError: AppPackage/AnimationClass : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at alumni.login.<init>(login.java:28)
at alumni.Alumni.main(Alumni.java:18)
When i click a button in Selenium WebDriver I get the following error, using Firefox 43 and Selenium 2.47.1:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/selenium/firefox/FirefoxDriver : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at testDay1.main(testDay1.java:8)
I've got an install4j question.
I was wondering if it is possible to update the bundled JRE of an application that is already installed.
For example, in our application we had a bundled java 6. Now, we upped the minimum version to java 7 and we bundle JRE 8.
For new installations this works fine. But with existing installs, but JRE 8 is not downloaded in the update process, and after updating the application gives an error at startup:
java.lang.UnsupportedClassVersionError: camMan/shared/E/p : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at camMan.c.b.s.<clinit>(Unknown Source)
at camMan.unsecure.LoginLauncher.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.exe4j.runtime.WinLauncher.main(Unknown Source)
at com.install4j.runtime.launcher.WinLauncher.main(Unknown Source)
I'm using install4j version 5.1.15.
- We use a dynamic bundle (download on demand)
- "install as a shared JRE" is disabled
- "install only if no other suitable JRE is found" is enabled.
Thanks in advance!
I have an application that when run in the IDE (Netbeans 8) works fine. The program makes use of 4 external .jar libraries. It also has a virtual machine argument pointing to a DLL. When I try to execute the .jar from the command line I get an error. This leads me to believe that there is a classpath issue.
This is the error itself:
C:\Users\piuser\Documents\NetBeansProjects\GameTrakaDesktopClient\dist>java -jar
GameTrakaDesktopClient.jar
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for
Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
at sun.security.util.SignatureFileVerifier.process(Unknown Source)
at java.util.jar.JarVerifier.processEntry(Unknown Source)
at java.util.jar.JarVerifier.update(Unknown Source)
at java.util.jar.JarFile.initializeVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
at sun.misc.Resource.cachedInputStream(Unknown Source)
at sun.misc.Resource.getByteBuffer(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at gametrakadesktopclient.MainMenuUI.main(MainMenuUI.java:242)
C:\Users\piuser\Documents\NetBeansProjects\GameTrakaDesktopClient\dist>
I have used a workaround to get around this problem because I couldn't figure out a solution. I opened all of the JAR files that my application depends on and removed the META-INF/.DSA and META-INF/.SF files
I've developed an applet that uses Java extension mechanism to install an extension package.
Both JARs are signed, and I have put this in the manifest:
Permissions: all-permissions
Codebase: *
Application-Library-Allowable-Codebase: *
Caller-Allowable-Codebase: *
It works fine with the JRE 1.7 update 45, but with the last version of the JRE (1.7 update 51), I get the following error:
java.lang.NullPointerException
at com.sun.deploy.security.DeployManifestChecker.verifyCodebase(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verifyApplicationLibraryAllowableCodebase(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.TrustDecider.isAllPermissionGranted(Unknown Source)
at sun.plugin.extension.ExtensionInstallationImpl.verifyJar(Unknown Source)
at sun.plugin.extension.ExtensionInstallationImpl.access$100(Unknown Source)
at sun.plugin.extension.ExtensionInstallationImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.extension.ExtensionInstallationImpl.installExtension(Unknown Source)
at sun.misc.ExtensionDependency.installExtension(Unknown Source)
at sun.misc.ExtensionDependency.checkExtension(Unknown Source)
at sun.misc.ExtensionDependency.checkExtensions(Unknown Source)
at sun.misc.ExtensionDependency.checkExtensionsDependencies(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.parseExtensionsDependencies(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getClassPath(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
If I copy the package extension in the lib/ext directory of the JRE, then the applet works.
I've read the changes in the new JRE, but how would I get this to work?