JavaFX application does not compile well when using LauncherImpl instead Application [duplicate] - java

This question already has answers here:
Java 9 JavaFX Preloader
(3 answers)
Problem With JavaFX/Intellij Setting When Try To Use LauncherImpl For Preloader
(1 answer)
Closed 1 year ago.
I have a JavaFX application which compiles to native using GluonFx plugin.
I want to add a Preloader to show when starting. I managed it by changing the initialization from:
Application.launch(MainView.class, args) to LauncherImpl.launchApplication(MainView.class, MyPreloader.class, args)
The compilation process executes till the end with no errors, but the app doesn't boot.
If I try to run the agent (mvn gluonfx:runagent) I have the following error:
cannot access class com.sun.javafx.application.LauncherImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to unnamed module
Someone knows how to solve this, or what other way can I use to load my Preloader?
PS: Running from the IDE works. The problem is after compilation to native
Thanks in advance

I've found the solution by using the answer in this ticket:
Java 9 JavaFX Preloader
Replaced:
LauncherImpl.LauncherImpl.launchApplication(MainView.class, MyPreloader.class, args)
by
System.setProperty("javafx.preloader", MyPreloader.class.getCanonicalName());
Application.launch(MainView.class, args);

Related

Why does Java not compile my code? [duplicate]

This question already has answers here:
Java: Unresolved compilation problem
(10 answers)
Closed 4 years ago.
Language: Java
JRE: jre1.8.0_144
IDE: Eclipse Oxygen Release (4.7.0)
Description: After I hit the "run" botton, the code did not compile and red text appear in the console.
Screenshot:
Here is the code:
package chapter3.project2;
import java.util.*;
public class MetricConversion {
public static void main(String[] args) {
System.out.println("WTF Eclipse?");
}
}
error message:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at chapter3.project2.MetricConversion.main(MetricConversion.java:30)
It seems that no matter what I put in the main method, the error just kept popping up.
Thank you.
Where is jre library? Why not compile and run from source folder?
Check project property and add jre runtime library also create source folder (src) and compile and run.
Or
Build a clean Java project and add packages and classes in src folder.

How can I run this android project by using eclipse? [duplicate]

This question already has answers here:
No resource found that matches the given name '#style/Theme.AppCompat.Light'
(4 answers)
Closed 6 years ago.
I want to compile and run the project (Signal-Android : Openwhisper) by using Eclipse. Is there anyway to do that? (the reason that I have to use Eclipse because of its add-on 'call graph viewer'. I want the call graph of the project. If anyone has other idea, you can post here also)
I have ADT installed already.
when I tried to run it. Lots of error appeared
No resource found that matches the given name 'Theme.AppCompat.NoActionBar'.
No resource found that matches the given name '#style/Theme.AppCompat.Light.DarkActionBar'.
No resource found that matches the given name '#style/Widget.AppCompat.ActionBar'.
... Actually it has more than 20 lines of error
Errors from Eclipse:
I found that most people using Android Studio but I cant find how to create call graph.
I tried to add Appcompat v7 as support Library but in Propertied > android > Library when I click add. It has nothing inside but I'm sure in sdk/extras/android/support/v7/appcompat/libs has v7 appcompat.jar
Check the android version you have downloaded and installed... and which version is set as target for your application...

java.lang.VerifyError when using vaadin and vaadin-server

For a project I am working on, which depends on vaadin-6.8.12, I would like to use the Page/JavaScript classes included in the vaadin-server-7.0.6 JAR.
However, when I include vaadin-server, I get a java.lang.VerifyError when attempting to use the Page.getCurrent() method.
To illustrate this, I wrote a small test program which exhibits the same behaviour:
import com.vaadin.server.Page;
public class Main
{
public static void main(String[] args)
{
Page page = Page.getCurrent();
System.out.println(page);
}
}
I have set the classpath in a file (the JAR files and Main.class are in the same folder):
vaadin-6.8.12.jar:vaadin-server-7.0.6.jar:vaadin-shared-7.0.6.jar:vaadin-
shared-deps-1.0.2.jar:vaadin-theme-compiler-7.0.6.jar
Then run the program like this:
java -cp $(cat vaadin.classpath):. Main
When run, I get the following error:
Exception in thread "main" java.lang.VerifyError: (class:
com/vaadin/server/Page, method: getJavaScript signature:
()Lcom/vaadin/ui/JavaScript;) Incompatible argument to function
at Main.main(Main.java:7)
However if I reverse the order of vaadin-6.8.12 and vaadin-server-7.0.6, I do not get the java.lang.VerifyError.
I have tried the same test for different versions of vaadin and vaadin-server, always with the same result as above.
vaadin is not listed as dependency of vaadin-server (and vice-versa) in the maven POM. Im am using JDK version 1.6.0_32. Does anyone know what could be causing this?
Many thanks.
You cannot combine Vaadin 6 and Vaadin 7 that way. If you want to use features from Vaadin 7 you need to migrate the whole application to use Vaadin 7.
If you want to execute some JavaScript from server side, Vaadin 6 has the Window.executeJavaScript() method that you can try to use.

Eclipse wanting to run wrong class [duplicate]

This question already has an answer here:
Eclipse is running the wrong class [closed]
(1 answer)
Closed 8 years ago.
I am a new java developer out here, and ive come across this weird thing, that eclipse still thinks my main class is called illuminati (just randomly wrote something..)
here is a screenshot of the error i get:
so what the problem is, basicly eclipse cant find the mainclass even though i changed the name..
and i dont know how to configure it that the class is gone (or changed name)
Thanks in advance!
Just select the class you want to run (MAIN), then click the green-arrow-in-circle Run icon, and select "Run As -> Java Application".
If you rename the class and you didn't let Eclipse rename the run configuration, then you can simply create a new run configuration for the new class.

Activator not called if plugin created by JAR [duplicate]

This question already has an answer here:
invalid activator
(1 answer)
Closed 5 months ago.
I created eclipse plugin from Extenal JAR file, Like EclipseJarToPlugin.
Then in MANIFEST.MF I'm adding Activator for this plugin.
But the problem is this Activator never called. Even while creating plug-in there is no option for Activator.
Is there is any way so that we can know when first time any Exported class of this plugin(of jar) is called.?
How does your Activator looks like? Try simple activator, which implements BundleActivator interface.
Have you checked "Activate this plug-in when one of its classes loaded" - this is a checkbox on the "Overiview" tab of your Manifest editor:

Categories

Resources