I'm new to java, I'm trying to build a JavaFX Application on eclipse using e(fx)clipse by following a tutorial and did exactly the same, the application is very simple, when I try to compile it I get bunch of errors which I don't even understand :
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2021)
at ch.makery.address.controler.MainApp.start(MainApp.java:29)
at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:67)
... 1 more
please can you tell me what I'm missing.
You have to set the location of the FXML file in your loader, be sure that you are providing the correct PATH to your FXML file.
PS: Netbeans is the best choice for a JavaFX beginner, start Here.
Related
My application uses javafx 11.0.1 and is shipped bundled with a jlinked version of openjdk 11. It runs fine for the vast majority of the users but few of them are getting this stack:
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
I found some discussion related to the same exception but regarding Maven+Eclipse, here and here. The issue is very similar, user reporting it, do have other java installations and uninstalling them solves the issue, so basically leaving my bundled openjdk as the only option the application starts, but if there is another Java installed on the system, the wrong .dll is picked up and the application crashes with the above stacktrace.
I tried the suggested java.library.path workaround but users are saying it doesn't solve. Unfortunately I cannot reproduce it myself, any idea on how to solve it or what to ask the users reporting it?
EDIT: we fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
We fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
When trying to run the WordCount example pipeline using Dataflow under Eclipse IDE, I get the following error:
Exception in thread "main" java.lang.RuntimeException: Failed to construct instance from factory method DataflowRunner#fromOptions(interface org.apache.beam.sdk.options.PipelineOptions)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:233)
at org.apache.beam.sdk.util.InstanceBuilder.build(InstanceBuilder.java:162)
at org.apache.beam.sdk.PipelineRunner.fromOptions(PipelineRunner.java:55)
at org.apache.beam.sdk.Pipeline.create(Pipeline.java:150)
at com.google.cloud.dataflow.examples.WordCount.main(WordCount.java:178)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.beam.sdk.util.InstanceBuilder.buildFromMethod(InstanceBuilder.java:222)
... 4 more
Caused by: java.lang.IllegalArgumentException: Missing object or bucket in path: 'gs://mysite-ga-datastreaming-196008-my-bucket/', did you mean: 'gs://some-bucket/mysite-ga-datastreaming-196008-my-bucket'?
at org.apache.beam.sdks.java.extensions.google.cloud.platform.core.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:383)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.verifyPath(GcsPathValidator.java:77)
at org.apache.beam.sdk.extensions.gcp.storage.GcsPathValidator.validateOutputFilePrefixSupported(GcsPathValidator.java:60)
at org.apache.beam.runners.dataflow.DataflowRunner.fromOptions(DataflowRunner.java:246)
... 9 more
Some people suggest that the error is due to the Java version, as it seems that Beam doesn't work fine with Java 9. Anyway, I'm still using Java 8. On the other hand, some other people say that the error is caused because you have to provide a subfolder under your bucket as the storage location. I've tried, but it still does not work.
If anyone faced this same issue before or can provide any advice on the error, it would be appreciated.
You should create bucket gs://mysite-ga-datastreaming-196008-my-bucket/ in Google Cloud Storage before use the pipeline.
Create mysite-ga-datastreaming-196008-my-bucket in the GCP Project.
For Bucket Creation :
Go to GCP UI, select Storage Bucket. Click Create Bucket Button. Enter Bucket name mysite-ga-datastreaming-196008-my-bucket. Click ok.
Then run the command.
I'm working on Face Recognition Project by using OpenCV 2.4.9, JavaCV 0.7,JAVA version 8 and Eclipse IDE... I am getting these Exceptions continuously.. Is there something wrong in the follwoing code? It's not my complette code...
Please Someone help me as soon as possible...
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.cpp.opencv_objdetect;
Loader.load(opencv_objdetect.class);
Exceptions:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_objdetect in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:91)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:561)
at FaceRecognizer.<init>(FaceRecognizer.java:56)
at FaceRecognizer.main(FaceRecognizer.java:112)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\XYX\AppData\Local\Temp\javacpp183187286948746\jniopencv_objdetect.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
... 8 more
This page gives a description of how to get an OpenCV Java sample running. There should be two things that you need to do:
You need to call System.LoadLibrary specifying the OpenCV DLLs that it uses
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Make sure the DLL in somewhere where it can be found by the JVM. There are a few ways if doing that. I don't use Eclipse but this seems to give a good explanation. Alternatively, a simple bodge just to get things working is to drop the DLL into the windows\system32 directory
Finally there may be an issue if you are running a 64 bit JVM but trying to use a 32 bit DLL. If you are still having trouble make sure you are using matching JVM and DLL.
It looks like one of the java libraries that you are using in your project is using jni calls that uses dll files. Do you have the library installed correctly? It looks like it is called opencv or something that is related to jniopencv_objdetect.dll
I have a javafx program that I was formerly developing in sublime text before migrating to intellij as my editing environment. As of now, I can compile and run without error through the command line (Windows). However, when I try to run it from intellij, I get the following message:
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(LauncherImpl.java:157)
at com.sun.javafx.application.LauncherImpl$$Lambda$1/868693306.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3201)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3169)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3142)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3118)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3098)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3091)
at Main.setNewScene(Main.java:40)
at Main.start(Main.java:29)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
at com.sun.javafx.application.LauncherImpl$$Lambda$50/2069914884.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/646648017.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/1106256089.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/151108218.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/2004449016.run(Unknown Source)
... 1 more
Process finished with exit code 1
I don't know how to fix this.
The problem turned out to be intellij having an issue with the source folder in the project directory. By moving all my java files to a new directory and reopening it in intellij as a new project with a single, correct source folder, the problem completely went away.
(As stated in the question, the code itself was functional and worked through the command line.)
I am running a test case using java & fitnesse...
while Clicking on the "Test" button from below image,
It showing error as follows:
Standard Error:
Exception in thread "main" java.lang.NoClassDefFoundError: ":build/classes://////var/www/git/vodaware/java/Build:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/mockito-all-1/9/5/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/jsp-api/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/testng-6/8/7/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/servlet-api/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/jcip-annotations-1/0/jar
Caused by: java.lang.ClassNotFoundException: ":build.classes:......var.www.git.vodaware.java.Build:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.mockito-all-1.9.5.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.jsp-api.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.testng-6.8.7.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.servlet-api.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.jcip-annotations-1.0.jar
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:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: ":build/classes:../../var/www/git/vodaware.java/Build:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/mockito-all-1.9.5.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/jsp-api.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/testng-6.8.7.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/servlet-api.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/jcip-annotations-1.0.jar. Program will exit.
What is the cause of this logs? Please anyone help me.
As the error says, the program is not able to find the java class. You need to make sure the
class path is set properly and also make sure the package location is set properly.
Ex:
classpath: foo/bar/
package: jane/doe.class
See to it that you mention the package hierarchy properly while setting it in the fitnesse column.
Hope this helps.