gleidsonmt / DashboardFx

JavaFx Dashboard
https://gleidsonmt.github.io/
GNU General Public License v3.0
468 stars 143 forks source link

How do you run this demo app? #36

Closed bdw429s closed 1 year ago

bdw429s commented 1 year ago

I feel sort of silly here, but I'm 100% new to JavaFX and only a little familiar with Gradle and I can't even figure out how to run this app, lol. The readme doesn't really cover this, so I've tried running all sorts of Gradle tasks, but they all either error or do nothing. gradlew test for example fails on a clean clone of the repo.

Error occurred during initialization of boot layer
java.lang.RuntimeException: Unable to parse --add-opens <module>/<package>: io.github.gleidsonmt.dashboardfx/

I was able to create a DashboardFx-1.0.jar with gradlew jar, but I have no idea how to run it. JavaFx's docs say gradlew run should work, but that errors

Execution failed for task ':run'.
> 'java.lang.String org.gradle.api.tasks.JavaExec.getMain()'

Running gradlew build returns the same error as above.

I tried running the jar with java -jar, but there is no main class in the manifest. So I tried running it with

java -cp build\libs\DashboardFx-1.0.jar io.github.gleidsonmt.dashboardfx.Start

but that just errors with

Error: Could not find or load main class io.github.gleidsonmt.dashboardfx.Start
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

so there's clearly more needed. Sorry if this is a silly question, but I have no earthly idea what magic thing I need to do just to get this up and running to play with it. Thanks!

joseph-zabaleta commented 1 year ago

I second this issue. I can't seem to get this program to run properly. I am also new to JavaFX but been using Maven instead of gradle. Install instructions would be helpful to get the ball rolling.

joseph-zabaleta commented 1 year ago

@bdw429s had a friend look at the project to see if he can get it working, we all experiences the same issues with gradlew run, gradlew tests, etc. However, he was able to get it to launch utilizing the bash shell script. sh gradlew run. Hopefully this helps and you are able to see the product.

bdw429s commented 1 year ago

@joseph-zabaleta Thanks for the note. As a Windows user, I'm not sure how I'll utilizing the Bash shell scripts, but I'll look at them to see if there are any clues to help get it working.

joseph-zabaleta commented 1 year ago

@bdw429s I am also a window's user but use the git-bash terminal. I actually got it up and running and haven't had time to checkout the features. @gleidsonmt Where are you at :D?

gleidsonmt commented 1 year ago

@joseph-zabaleta Thanks for the note. As a Windows user, I'm not sure how I'll utilizing the Bash shell scripts, but I'll look at them to see if there are any clues to help get it working.

Hi Joseph.. I'm sorry.. I'm trying to write a readme.. and I tried to produce a video tutorial.. but.. I don't have time.. I really don't understand your problem.. you describe a lot of things.. but I didn't understand what happened.. what your gradle version, your jdk? Are you missing libs? Gime.. do you using intellij?

gleidsonmt commented 1 year ago

@bdw429s I am also a window's user but use the git-bash terminal. I actually got it up and running and haven't had time to checkout the features. @gleidsonmt Where are you at :D?

Hi, yes it also possible.. I'm thinking they had a problem with modules..

joseph-zabaleta commented 1 year ago

@gleidsonmt All good, busy busy Ill keep an eye out for your updated readme and what not. I use intelijj and am new to javaFX in general. I did get your project to run using the shell script.

gleidsonmt commented 1 year ago

@bdw429s , @joseph-zabaleta Well, guys, I've been having real trouble when trying to create an exe.. or a jar file.. I mean using new JavaFx 17.. and Gradle had different types to initiate them.. Since JavaFx 8, I don't have create an executable.. 1º I forget that the resources default package must have the same name.. When trying to get an exe.. this causes an error with the JVM.. 2º The new gradle version causes an error with you try to build a jar using old techniques..

I'll update whole project in a few steps... but if you want a jar.. to view what is happening inside.. I recommend you use this, it's commented, because causes errors when I build exe.. also it's important to use duplicateStrategy.. only des comment.. this part in build.gradle.. Temporarily I am using a new branch master.. pull the project and change to this branch.. I'll merge with the main soon

jar {
    duplicatesStrategy = DuplicatesStrategy.WARN
    manifest {
        attributes(
                'Main-Class': 'io.github.gleidsonmt.dashboardfxcopy.Starter'
        )
    }
    from {
        configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

Packaging using jpackage is all possible, only remember you need tools to build, I use windows, so I need wix tools comment the jar task before you run this command, or you'll receive an error..

     gradle clean build jpackage

I like to use this mut-tasks in the same line...