Closed swegs closed 4 years ago
@swegs I have fixed the bug, please try with release 1.1.1.
I guess it's because the entry class org.eugene.App extends other class which is described here: https://stackoverflow.com/a/38133937/3378204
I got this error using Maven, and I discovered the solution.
Error: Could not find or load main class com.mycompany.testapifactory.Main
I'm using java JDK version 1.7 on Linux, my
pom.xml
file was the default generated by Netbeans and I was using these commands to compile, which do work fine with a normal hello-world java application:mvn clean compile java -jar target/TestAPIFactory-1.0-SNAPSHOT.jar com.mycompany.testapifactory.Main
What happened:
It turns out my problem was that my Main method was extending something Exotic like this:
public class Main extends SomeExoticLibraryClass{ public static void main(String[] args){ //... } }
It was this extending of the main class that caused the above error.
TLDR solution:
Make sure your main class isn't extending any 3rd party classes. Refactor those out and away into their own classes. That error message is awful, and requires process of elimination to find out what to do.
Tried your new version and now I'm getting
Computer:Downloads $ java -jar BigdataFileViewer-1.1.1-SNAPSHOT-jar-with-dependencies.jar Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:719) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:642) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:600) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at org.eugene.App.main(App.java:13) Caused by: java.lang.ClassNotFoundException: javafx.application.Application at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 10 more
@swegs Thanks for your comment. At least we saw the progress we made, the main entry is not invisible now.
And for your current issue, the javaFX library is missed on your environment as mentioned in README.txt.
Make sure the Java has javafx bound. For example, I installed openjdk 1.8 on Ubuntu 18.04 and it has no javafx bound, I installed it following guide here [https://stackoverflow.com/questions/56166267/how-do-i-get-java-fx-running-with-openjdk-8-on-ubuntu-18-04-2-lts/56166582#56166582].
The javaFX library is not always in the java package and it depends version by version. I'm afraid you need to install the javaFX library and put it to your local system.
@swegs There is a similar thread https://stackoverflow.com/questions/58426650/how-to-create-javafx-programs-in-jdk-13. The javafx library is removed in java11 and I guess the higher version java13 also doesn't have javafx bound. I suggest you to install javafx library to your MAC or just installed multiple java on your machine. You can switch java version by setting the environment variable on your local machine.
Thanks for the help.
Thought I'd follow up on this a little bit with instructions I used to resolve my issue.
export PATH_TO_FX=path/to/javafx-sdk-11.0.2/lib
java --module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml -jar BigdataFileViewer-1.2.1-SNAPSHOT-jar-with-dependencies.jar
@swegs Good summary, thanks for this follow up. These instructions might help others who run into same situation.
I'm on MacOS and running the invoke command from the same directory where the jar was downloaded. Below is the version of java installed and the error output.
Computer:Downloads $ java -version java version "13.0.2" 2020-01-14 Java(TM) SE Runtime Environment (build 13.0.2+8) Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
Computer:Downloads $ java -jar BigdataFileViewer-1.1-SNAPSHOT-jar-with-dependencies.jar Error: Could not find or load main class org.eugene.App Caused by: java.lang.NoClassDefFoundError: javafx/application/Application