I try to run the JavaFX sample program, Henley Car Sales, from Oracle [site][1],
http://download.oracle.com/otndocs/products/javafx/samples/DataApp/
[1]: ,http://download.oracle.com/otndocs/products/javafx/samples/DataApp/, I tried it on two different machines and on three different browsers on each machine. It will only up for few seconds and then get the following exception:
Missing Permissions manifest attribute in main jar: http://download.oracle.com/otndocs/products/javafx/samples/DataApp/DataAppClient.jar
java.lang.ExceptionInInitializerError
at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.<clinit>(AbstractMessageReaderWriterProvider.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
I do have the latest Java installed. I don't know what I can do to make it working.
EDIT:
Above link is a valid link and the JavaFX application is there and can be downloaded to your browser automatically after the click. My browsers can run it but only few seconds due to the exception I pasted.
Quote from http://docs.oracle.com/javafx/2/overview/jfxpub-overview.htm :
Note: The DataApp sample has multiple NetBeans projects and cannot be run without some additional setup. The DataAppReadme.html file and the NetBeans project file are in the src\DataApp directory.
Everything else you have to know is explained on that site.
Related
I've read tons of materials but I can't figure out what's happening. I'm doing a simple web application with Eclipse Oxygen, GWT 2.8, MapDB3, when I try to launch the web app through Run as --> GWT development mode with Jetty I obtain the error above. I'm going mad.
Problem accessing /asteonlineing/greet. Reason:
HTTP 500 Server Error
Caused by: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at org.mapdb.DBMaker.fileDB(DBMaker.kt)
at com.google.asteonlineing.server.AoLServiceImpl.<init>(AoLServiceImpl.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [...a lot more]
I tried to add the kotlin's jar to my project's lib directory but the error slightly changes and it's alway http error 500 but about:
java.lang.NoClassDefFoundError: org/eclipse/collections/impl/list/mutable/primitive/LongArrayList
Finally I've figured out that MapDB 3.0.5 has a long list of dependencies.
I've installed all of them and that error disappeared but others are coming, but code related.
Finally I've figured out that MapDB 3.0.5 has a long list of dependencies, when I've installed all of them that error disappeared.
You can find them in
https://mvnrepository.com/artifact/org.mapdb/mapdb/3.0.5
First off. I am a newbie and green with respect to Java programming.
I created a Java Eclipse "SWT" "Application Window" on a Eclipse Kepler 4.3.1 (32-bit) running WindowBuilder and SWT (swt.jar). The design view is a composite.
The java application runs fine from Eclipse. I simply press the play button and presto.
Problem:
Issuing
java -cp . PkgNetAccelerator32.netAcceleratorApp
yields the following error message:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Composite
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)
... 6 more
I was doing some research and several posts on other issues suggested that the cure is to create a manifest. I saw an article that said something like:
Select the src folder, right click and select export, then Java, then JAR file, specify Manifest.jar and a path on the folder, make sure the "Generate the manifest file" is selected, and press finish.
I created the manifest file and tried launching it with the following command line:
java -jar ../Manifest.jar -cp . PkgNetAccelerator32.netAcceleratorApp
That yielded the same error message above.
I saw another article that said that one should add in the swt.jar file, but that is taken care of by the manifest. No? Specifying "swt.jar" instead of the manifest that I created resulted in an error message:
no main manifest attribute, in ../swt.jar
That error message makes sense.
I am at a loss. How do I run the java application?
I am testing on my Windows 7 Professional 64-bit desktop, but I need to run on CENTOS too. That should be no problem, as I assume whatever the fix on Windows is, will work on CENTOS.
UPDATE:
I placed the two lib files in a /lib folder to match the answer given. I then issued the following command line and got the following error message.
C:\SoftDev\Projects\NetAccelerator\JavaWorkspace\NetAccelerator32>java -cp "bin/*;lib/*" PkgNetAccelerator32.netAcceleratorApp
Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at PkgNetAccelerator32.netAcceleratorApp.open(netAcceleratorApp.java:43)
at PkgNetAccelerator32.netAcceleratorApp.main(netAcceleratorApp.java:33)
I found the following article, which produces a command line that works, just that is not reasonable for sending. I much rather use the answer.
Lets assume you have a eclipse project structure similar to this:
Workspace
-> Project
-> src (source code directory)
-> bin (compiled byte code directory as JAR)
-> lib (jar directory)
-> .classpath (eclipse file)
-> .project (eclipse file)
I am assuming that you are exporting the JAR as an executable JAR.
So in order to run a class in that exported JAR with another JAR from the lib directory (swt.jar) while your working directory is the Project directory you will need to execute:
java -cp "bin/*:lib/*" PkgNetAccelerator32.netAcceleratorApp
Using wildcards requires Java 6 or later
Please note: CENTOS requires : as a path separator. Windows uses a semi-colon.
This will add your classes and the swt classes onto the classpath and run your main class PkgNetAccelerator32.netAcceleratorApp
SWT 32bit vs 64bit
You will either need to use a 32bit JVM locally or continue to use a 64bit JVM and use the 64bit version of swt; see swt on windows 64 bit. I would suggest you match your version of your local JVM (32bit or 64bit) with the version that you will be running on the CENTOS machine. You will however need a different swt jar for CENTOS.
I'm trying to get started with OpenNI 2 using Java and the Kinect for Windows Sensor (Not the Xbox version) yet am experiencing significant problems.
While the sample SimpleViewer program functions correctly, I cannot get the Java equivalent to run (SimpleViewer.java). It successfully compiles after I added org.openni.jar to my classpath, yet upon attempting to run the program I am faced with the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Open
NI2\Tools\OpenNI2.jni.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.openni.NativeMethods.<clinit>(NativeMethods.java:44)
at org.openni.OpenNI.initialize(OpenNI.java:113)
at OpenNITest.SimpleViewerApplication.main(SimpleViewerApplication.java:
190)
After reading up on similar problems I attempted the following to try to resolve the problem, having thrown pretty much every library I could find in OpenNI into the Tools folder (Contents of Lib and Tools/OpenNI2/Drivers) in case it wasn't finding the correct dependencies.
java -Djava.library.path="C:/Program Files/OpenNI2/Tools" OpenNITest.SimpleViewerApplication
I'm running Windows 7 Enterprise Edition, Java 1.7.0_21 and the latest version of OpenNI 2. OpenNITest is the name of the folder and package I put the sample application in.
If anyone has any advice for trying to resolve this problem it would be greatly appreciated as I've been at it for 3 hours yet am still failing miserably at resolving it.
Thanks!
Finally got this working, add the following and load the library OpenNI2.dll (directory to wherever it is on your machine or use loadLibrary() if you want a relative path) and all will be merry, just wish OpenNI had included an actually working Java sample!
static {
try {
System.load("C:\\Program Files\\OpenNI2\\Tools\\OpenNI2.dll");
}
catch (Exception e)
{
e.printStackTrace();
}
}
Sorry for this question but I'm a newbie to Java. I tried searching for similar problems, and I did find some answers, but none worked in my case, so here it goes:
I'm trying to load a java applet on a web page. The applet is supposed to be loaded from a .jar file (UCFApplet.jar), but I cannot get it to load no matter what.
Here's the html for the applet:
<applet id="UCFApplet" height="200" width="200"
code="com.fujitsu.test.applet.UCFApplet"
archive="UCFApplet.jar">
</applet>
The jar file is on the server, on the same folder than the html file that is trying to load it. Inside the jar file there's a UCFApplet.class file on com/fujitsu/test/applet folder.
The error I'm getting on the Java console is the following:
Java Plug-in 1.6.0_29
Using JRE version 1.6.0_29-b11 Java HotSpot(TM) Client VM
User home directory = C:\Users\PTMAIAJ
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
load: class com.fujitsu.test.applet.UCFApplet not found.
java.lang.ClassNotFoundException: com.fujitsu.test.applet.UCFApplet
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: com.fujitsu.test.applet.UCFApplet
As you can see, I'm using jre 1.6.0_29 build 11, which, from what I get on the Oracle page, is the latest build. This happens on all browsers (IE 9, FF, Chrome).
I suspect it may have something to do with not being able to access the .jar file because if I change the html code to a dummy name such as archive="thisFileDoesNotExist.jar" it gives me the same error. But I don't really know what to put there in order to make it work.
Any idea about what I can be doing wrong ?
Thank you and best regards,
Joao Maia
Your descriptor seems to be correct, so try the following.
First check that browser can download the jar. Type the direct URL to jar file into your browser. For example if your html can be accessed by typing
http://localhost/myapp/mypage.html
type
http://localhost/myapp/UCFApplet.jar
If you can download the jar and it is identical to your jar continue.
Check the jar itself. Type in command line
jar vft UCFApplet.jar
and see output. You should be able to find your class:
/com/fujitsu/test/applet/UCFApplet.class
BTW do you know that applet tag is deprecated and is not supported by Opera and Chrome? To support all browsers you should use tag object
Try turning on tracing in the java control panel. It will then produce a log file in the following path that may help:
%USERPROFILE%\AppData\LocalLow\sun\java\Deployment\log
In my case I had an error which only appeared when I turned on tracing, and which presented as simply a "ClassNotFoundException":
java.util.zip.ZipException: duplicate entry: META-INF/LICENSE.txt
The applet loader was rejecting the jar because the zip file had a duplicate file entry. Strangely appletviewer.exe was able to load and run this jar fine.
For those of you running behind a corporate proxy. According Oracle ClassNotFoundException is "a common error that is seen if the proxy settings are not correct".
See: How do I configure proxy settings for Java?
I have configured JDEE in emacs. But when I try to run any App, it throws NoClassDefFoundError .
Upon compilation, although a class file is created, it only shows the buffer for sometime and then closes it.
The same files if compiled and run from the terminal work perfectly fine.
Also, on this machine I have java-6-openjdk installed. I had configured JDEE on my home computer which has sun java jdk and there are no such problems there.
Other than this, features such as code completion, generation etc work fine.
How do I solve this? Is this due to open jdk ?
I am using a Ubuntu 10.04 desktop.
This is the stack trace
cd /home/vineet/java/KodeJava/src/org/kodeplay/kodejava/
/usr/lib/jvm/java-6-openjdk/bin/java org.kodeplay.kodejava.EmacsTest
Exception in thread "main" java.lang.NoClassDefFoundError: org/kodeplay/kodejava/EmacsTest
Caused by: java.lang.ClassNotFoundException: org.kodeplay.kodejava.EmacsTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.kodeplay.kodejava.EmacsTest. Program will exit.
Process org.kodeplay.kodejava.EmacsTest exited abnormally with code 1
Thanks
something in your config is wrong. you are trying to run from the "/home/vineet/java/KodeJava/src/org/kodeplay/kodejava/" directory, but in order to find your class on the classpath, you should be running from "/home/vineet/java/KodeJava/src/". Probably need to configure the "jde-run-working-directory" variable.
From the question, it sounds as if the JDEE configuration is not complete when it comes to setting up the command to be launched when running the Java App.
If the same Java App can be run from the terminal with no issues, OpenJDK is not causing the trouble, I'd wager.
Perhaps you copied over from the other computer the JDEE configurations and did not adopt them for the new computer that has OpenJDK.