Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open JAR file #138

Closed
jaesimin opened this issue Oct 20, 2019 · 2 comments
Closed

Unable to open JAR file #138

jaesimin opened this issue Oct 20, 2019 · 2 comments

Comments

@jaesimin
Copy link

Please read up on how to write a good question

Environment

Describe your development environment

  • IntelliJ version: 2019.2.2
  • Java version: 11.0.2
  • Operating system version: Windows 10
  • other packages' versions

Issue

Unable to double-click / run the command java -jar duke-0.2.jar for the JAR file that I had created using gradlew shadowJar . I am only able to right-click the JAR file and run it in IntelliJ.

I had added and removed the dependencies according to #72.

There's no error in all the steps. The JAR file just doesn't work. Why?

Code/Log Trace

Executing `gradlew run' works:

image

Running java -jar duke-0.2.jar command:

image

Right-clicking JAR file in Intellij works:

image

image

@danielwys
Copy link

Remove the following lines from your build.gradle

id 'org.openjfx.javafxplugin' version '0.0.7' //javafx (line 6)
and
javafx { version = "11.0.2" modules = [ 'javafx.controls', 'javafx.fxml' ] } (line 23-27)
they are no longer required as the JavaFX dependencies will be specified by lines 43 - 60 instead (you can also optionally choose to remove line 55 - 60 as they are unnecessary).

Your jar file generated by shadowJar should then be able to run on any system.

However, I noticed another bug during testing - your program won't launch if the file data/duke.txt is not present. You might want to look into ways to create the file automatically instead of throwing an exception and closing - see #27

Hope that helps! :)

@jaesimin
Copy link
Author

Thank you! It works already :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants