.class path api java - java

I would like to insert an API java into a web page.
Even with such an easy code:
applet code =
'Ejs.Simulations._apps._examples.HVmin'
archive = 'Ejs/Simulations/_apps/_examples/HVmin/hVmin.jar',
width = 300,
height = 300 />
I get this error:
cargar: clase Ejs.Simulations._apps._examples.HVmin not found.
java.lang.ClassNotFoundException: Ejs.Simulations._apps._examples.HVmin
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.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)
Caused by: java.io.IOException: open HTTP connection failed:http://localhost/blanca/Ejs/Simulations/_apps/_examples/HVmin.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Excepción: java.lang.ClassNotFoundException: Ejs.Simulations._apps._examples.HVmin
I don't know where to put HVmin.class, I have tryed in differents paths with the same result.
The file HVmin.class is in this path:
C:\xampp\htdocs\blanca\Ejs\Simulations\_apps\_examples\HVmin
Any help, please?
Thanks in advance

Just put that class in the .jar file with the rest of the applet.

Related

java .jar file convert to .exe file

I use launch4j to convert jar file to the exe file in Windows XP.
After I build wrapper, I go to test the wrapper.
However, it shows ""Error : A JNI error has occurred ,please check your installation and try again" and "A Java Exception has occured".
Below is the errors:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/swingx/JXDatePicker
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jdesktop.swingx.JXDatePicker
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)
... 7 more
What does the errors say? How should I do?
You need to add a jar that contains the class
JXDatePicker
This is where you can get it from http://www.java2s.com/Code/Jar/s/Downloadswingx094jar.html
Add it in the libraries, and link the path..It must not give this error.

Java Error whilst attempting to run a web-client

I'm having some problems while trying to open a web-client for a game that I play. I get this error and I don't know what to do. Help would be appreciated. If you need any more information please let me know and I will do the best I can to get it.
load: class client.class not found.
java.lang.ClassNotFoundException: client.class
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.ClassNotFoundException: client.class
It seems you are running your web client like this:
$ java client.class
Try running this instead:
$ java client

Java Web Start ClassNotFoundException

I'm trying to launch a runnable JAR file via web start, but am encountering an error with java not being able to find an external JAR (I think). When running the JNLP file, JWS starts, but then states that the application cannot be opened due to this error:
java.lang.reflect.InvocationTargetException
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.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at DevChat.canConnect(DevChat.java:326)
at DevChat.<init>(DevChat.java:89)
at DevChat.main(DevChat.java:348)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClient
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
The external JAR file mentioned, apache commons, is embedded in the runnable JAR and the JAR runs fine on it's own, just not in JWS. Suggestions?

Putting Java applet onto server

My applet that connects JS/Java with LiveConnect worked from localhost but when transferring to server I get this error in java applet console. Do I have to do something before I transfer these files?
java.lang.ClassFormatError: Incompatible magic value 1008821359 in class file PrintJob/Print_Runner 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 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.ClassFormatError: Incompatible magic value 1008821359 in class file PrintJob/Print_Runner
That means the class files didn't transfer properly. If you're using an FTP server make sure you have the binary option enabled.

java applet won't work

this is homework stuff, but the question is not much about coding. the task is to write a java applet to work on an m-grid server. i have the server running on apache. it has a few sample applets in .jar and .class form. the .class versions work; the .jar versions work on appletviewer, but they break if I submit them as a job to the server with this:
load: class examples/pixelcount/PixelCount.class not found.
java.lang.ClassNotFoundException: examples.pixelcount.PixelCount.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.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)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 7 more
Exception: java.lang.ClassNotFoundException: examples.pixelcount.PixelCount.class
I'm not really sure where exactly is the problem in here, given that they work on appletviewer. any help would be appreciated..
EDIT:
don't know if I wrote it clearly. by ".class version" i refer to html file with this content:
<applet height="300" width="450" code="examples/pixelcount/PixelCount.class"></applet>
and ".jar" with this content:
<applet height="300" width="450" archive="PixelCount.jar" code="examples.pixelcount.PixelCount.class"></applet>
EDIT2:
the mentioned example jar file can be found here
It can't find the file PixelCount.class, its not in the directory examples/pixlecount that's why this error is happening.
The PixelCount class is not packaged in your jar I think.
And as the error is Caused by: java.net.ConnectException: Connection refused: connect it might be that it tried to obtain that class from the net somewhere, and the location does not match or a proxy is in between.
EDIT
You do have the archive someplace the m-server, whatever that may be, can find it? See the Java Applet Tag ref. docs. You may need something like
CODEBASE = codebaseURL
This OPTIONAL attribute specifies the base URL of the applet--the directory
that contains the applet's code. If this attribute is not specified, then the
document's URL is used.
The CODE is relative to the base URL of the document which holds the applet tag. If you want to override that you might need that CODEBASE parameter.
Don't include the .class extension in the code attribute.
examples.pixelcount.PixelCount is the name of the class.
examples.pixelcount.PixelCount.class is the name of the file that contains the class.
The code attribute should read
code="examples.pixelcount.PixelCount"

Categories