user1300214
user1300214

Reputation:

IntelliJ artifact build not running from terminal

I'm running Ubuntu 16.04 LTS with IntelliJ Idea Community Edition.

Having finished my desktop application I wish to export to run as a standalone application. I have JRE9 installed.

Following the quick 60 seconds tutorial in this video, which is also the same as on the IntelliJ web site tutorial.

So I go to Project Structure, Artifacts, Add, Go to JavaFX tab, select the main class, OK, the build the artifact, open the containing folder and...

Double clicking the .jar file says it's not executable, so I chmod +x file.jar to make it executable, and that still doesn't run.

So in the terminal I go to the directory and type java -jar file.jar but that says Error: Could not find or load main class sample.Main.

But I've selected the main class in the Artifact window.

Any ideas how to fix this? Thanks.

UPDATE

My directory/file/file contents structure looks like this:

WorkingDirectory
    Myjar.jar
        META-INF
            MANIFEST.MF
                Manifest-Version: 1.0
                Created-By: JavaFX Packager
                Main-Class: sample.Main
                Class-Path: 
                Permissions: sandbox
                JavaFX-Version: 9.0.4
        sample
            Main.class
                public static void main(String[] args) { launch(args); }
    MyLib1.jar
    MyLib2.jar

I also have .jar files

Upvotes: 0

Views: 1056

Answers (1)

user1300214
user1300214

Reputation:

What a nightmare. It seems I have two JDK's installed on my system, and my IntelliJ project is setup to use JDK 9.0.4. My Linux system is defaulting to some other version.

So all I needed to type in the end was /opt/jdk-9.0.4/bin/java -jar JavaFXApp.jar.

Wasted two days.

Upvotes: 1

Related Questions