0

I have walked through the steps multiple times for creating an executable .jar file for my javaFX intellij project, but it has failed every time. I successfully build the .jar file, but when I click it nothing happens. I go to project structure, create artifact, add the main class, then build that artifact. Still nothing. I have included the picture of the file, but am unsure as to what to even show that would be causing this error. Any thoughts? enter image description here

enter image description here

[![enter image description here][3]][3]

The error i'm getting when running java -jar TestingProto.jar is: Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=sample/Maine, offset=6

i'm assuming there is an issue with versioning in my main class, but I don't use any third party jars, etc.

dgelinas21
  • 641
  • 3
  • 9
  • 22
  • Run it in the command line using `java -jar TestingProto.jar` to see the errors. – CrazyCoder Jul 17 '17 at 20:24
  • @CrazyCoder already tried, it just says "unable to access" – dgelinas21 Jul 17 '17 at 20:37
  • Post the full error text with the command line you've used. Also show your artifact configuration and the files inside the jar. – CrazyCoder Jul 17 '17 at 20:38
  • Do you realize that you specify the wrong file name? The jar is named `TestingProto.jar`, not `TestringProto_jar.jar`. You also run it from the wrong directory (`artifacts` instead of `artifacts\TestingProto_jar`). – CrazyCoder Jul 17 '17 at 21:13
  • @CrazyCoder at first glance I thought the file was .jar and ran it. I have updated the error message now. Hopefully this gives more insight – dgelinas21 Jul 19 '17 at 12:14
  • `myjar.TestingProto.jar` still seems to be wrong. Also, what is the output from `java -version` in the command line? – CrazyCoder Jul 19 '17 at 12:17
  • @CrazyCoder I changed the name, so I did run the correct .jar and still has the same output. As for java version, i'm using 1.7.0 – dgelinas21 Jul 19 '17 at 12:45
  • What language level is used in the project? Do you build for Java 7? Please share the [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – CrazyCoder Jul 19 '17 at 12:46
  • Also see https://stackoverflow.com/q/45154862/104891. Are there any digital signatures in the jars? – CrazyCoder Jul 19 '17 at 12:48

1 Answers1

0

For the moment, it is impossible to see what is wrong with your code. The folder structure looks like a mess. If a jar doesn't run then it has no entry point, which is the main() method in the Main class. If you have the main() method, then take a look at your package declarations above imports - they should be consistent with your folder structure below the src/main/java (in your case it is package sample;). I would recommend you to create a new JavaFX Maven project in your IDE, then in the same folder level as a Main class, create all your classes, including the Transform class (it shouldn't be outside the structure as it is now). Maven is a great tool and since you install it and set your environment variables, you will need to open a terminal/command line in the root folder of your new maven project and type mvn package and you will find your working .jar (or .war, if stated so in pom.xml) in a target folder (it will appear). But be sure you use the maven standard folder structure and that the package name in every class is the same as the folder structure, where this class actually resides, right after the src/main/java/ path.

Václav
  • 430
  • 1
  • 7
  • 22