Closed dominopizzaaaa closed 1 month ago
Tagging a few other students (randomly selected) who have completed related increments, in case they can pitch in: @BunnyHoppp @Oceankoh @LiuYJ2002 @leroytan @e1121208 @SherChew27 @Shantaa @Fluffykan @ryenl @kaikquah @yikjunxian @brianchoon @mingyang143 @Jayden-Kim-NUS @JovenSoh Others are welcome to pitch in too.
./gradlew run
on my system. The same environment is able to run my jar, so it is something with your project.Things done (that doesn't work):
gradle.build
file to run your project@dominopizzaaaa
I managed to recreate ur issue on my end, i think your version here is wrong:
id 'org.openjfx.javafxplugin' version '0.0.14'
I tried with the above version and got a similar error.
However, when I changed to version 0.1.0 like so:
id 'org.openjfx.javafxplugin' version '0.1.0'
the error went away.
@dominopizzaaaa
I managed to recreate ur issue on my end, i think your version here is wrong:
id 'org.openjfx.javafxplugin' version '0.0.14'
I tried with the above version and got a similar error.
However, when I changed to version 0.1.0 like so:
id 'org.openjfx.javafxplugin' version '0.1.0'
the error went away.
I tried changing the version, but i still meet the same issue on computer other than mine...
@dominopizzaaaa from what ive seen in your build.gradle
you seemed to have removed dependencies for all the different OS versions.
Could you try to change your dependencies in that file to something like:
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0'
String javaFxVersion = '17.0.7'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}
Furthermore you seem to have many ShadowJar methods and excess task methods than required. Maybe you can change the application, shadowJar and run methods to match the following:
application {
mainClass.set("mortalreminder.io.Launcher")
}
shadowJar {
archiveBaseName = "MortalReminder"
archiveFileName = "MortalReminder.jar"
archiveClassifier = null
}
run {
standardInput = System.in
enableAssertions = true
}
you can also refer to my build.gradle file for more reference.
@dominopizzaaaa from what ive seen in your
build.gradle
you seemed to have removed dependencies for all the different OS versions.Could you try to change your dependencies in that file to something like:
dependencies { testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0' testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0' String javaFxVersion = '17.0.7' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux' }
Furthermore you seem to have many ShadowJar methods and excess task methods than required. Maybe you can change the application, shadowJar and run methods to match the following:
application { mainClass.set("mortalreminder.io.Launcher") } shadowJar { archiveBaseName = "MortalReminder" archiveFileName = "MortalReminder.jar" archiveClassifier = null } run { standardInput = System.in enableAssertions = true }
you can also refer to my build.gradle file for more reference.
hm, i made my build.gradle file exactly the same as yours, but I am still facing the same issue. Is it possible that the problem is coming from a file that is not build.gradle?
Maybe you can share more about how you are creating the jar file in the first place then?
for myself, i did it exactly like this using the Command Line:
Another way to quickly see where the issue is coming from could be through the continuous integration method which is optional inside the course but I found it helpful to do a quick test to see if the app is compatible for more than my own OS. Simply follow this to try and set it up. Its not too difficult, just the addition of like one folder with one file inside your directory (make sure to remove the IO redirection parts below from the file)
- name: Perform IO redirection test (*NIX)
if: runner.os == 'Linux'
working-directory: ${{ github.workspace }}/text-ui-test
run: ./runtest.sh
- name: Perform IO redirection test (MacOS)
if: always() && runner.os == 'macOS'
working-directory: ${{ github.workspace }}/text-ui-test
run: ./runtest.sh
- name: Perform IO redirection test (Windows)
if: always() && runner.os == 'Windows'
working-directory: ${{ github.workspace }}/text-ui-test
shell: cmd
run: runtest.bat
It tries to build your app in github using 3 different OS version (Ubuntu, MacOS and windows), then if there is an error you can read thru what is going on inside github like this:
except if there is an error (not a warning like above), they will signal in red and stop the build.
Hi I tried cloning your master branch repo(hopefully that is the branch you are working on) and made several changes to some of the files. I'm not sure if this would solve the issue for you but it did on my end.
First I just copied most of my own build.gradle
file and applied to yours
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0'
String javaFxVersion = '17.0.7'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}
application {
mainClass.set("papadom.Launcher")
}
shadowJar {
archiveBaseName = "papadom"
archiveClassifier = null
}
run{
standardInput = System.in
}
[!Note] I removed the checkstyle options in the
build.gradle
file for ease of testing. You would probably want to add them back for grading purposes.
I then added a Launcher class at the same level as papadom
directory
package papadom;
import javafx.application.Application;
public class Launcher {
public static void main(String[] args) {
Application.launch(PapadomApp.class, args);
}
}
I also removed the main method from the PapadomApp
file
package papadom;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.util.logging.Level;
import java.util.logging.Logger;
public class PapadomApp extends Application {
public static final int WINDOW_WIDTH = 600;
public static final int WINDOW_HEIGHT = 400;
@Override
public void start(Stage primaryStage) {
try {
// Load the FXML file that describes the UI layout
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml"));
// Create a scene using the loaded FXML, setting the window size (600x400)
Scene scene = new Scene(fxmlLoader.load(), WINDOW_WIDTH, WINDOW_HEIGHT);
// Set the title of the window
primaryStage.setTitle("Papadom Chatbot");
// Set the scene (i.e., the window content) and display the window
primaryStage.setScene(scene);
primaryStage.show();
} catch (Exception e) {
Logger.getLogger(PapadomApp.class.getName()).log(Level.SEVERE, "Failed to load FXML", e);
}
}
// The main method launches the JavaFX application
}
This is how the directory looks
Hi I tried cloning your master branch repo(hopefully that is the branch you are working on) and made several changes to some of the files. I'm not sure if this would solve the issue for you but it did on my end.
First I just copied most of my own
build.gradle
file and applied to yoursplugins { id 'java' id 'application' id 'com.github.johnrengelman.shadow' version '7.1.2' } repositories { mavenCentral() } dependencies { testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0' String javaFxVersion = '17.0.7' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux' } test { useJUnitPlatform() testLogging { events "passed", "skipped", "failed" showExceptions true exceptionFormat "full" showCauses true showStackTraces true showStandardStreams = false } } application { mainClass.set("papadom.Launcher") } shadowJar { archiveBaseName = "papadom" archiveClassifier = null } run{ standardInput = System.in }
Note
I removed the checkstyle options in the
build.gradle
file for ease of testing. You would probably want to add them back for grading purposes.I then added a Launcher class at the same level as
papadom
directorypackage papadom; import javafx.application.Application; public class Launcher { public static void main(String[] args) { Application.launch(PapadomApp.class, args); } }
I also removed the main method from the
PapadomApp
filepackage papadom; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; import java.util.logging.Level; import java.util.logging.Logger; public class PapadomApp extends Application { public static final int WINDOW_WIDTH = 600; public static final int WINDOW_HEIGHT = 400; @Override public void start(Stage primaryStage) { try { // Load the FXML file that describes the UI layout FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml")); // Create a scene using the loaded FXML, setting the window size (600x400) Scene scene = new Scene(fxmlLoader.load(), WINDOW_WIDTH, WINDOW_HEIGHT); // Set the title of the window primaryStage.setTitle("Papadom Chatbot"); // Set the scene (i.e., the window content) and display the window primaryStage.setScene(scene); primaryStage.show(); } catch (Exception e) { Logger.getLogger(PapadomApp.class.getName()).log(Level.SEVERE, "Failed to load FXML", e); } } // The main method launches the JavaFX application }
This is how the directory looks
this works! thanks a lot! however, i tried it on different machines and it did not work on a Apple Silicon (ARM64) processor machine. does this matter? i understand the cs2103t website only gave us this:
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac' implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
i tried it on different machines and it did not work on a Apple Silicon (ARM64) processor machine. does this matter?
@dominopizzaaaa Was that machine using the exact JDK distribution we prescribed? If not, that could be the reason why it didn't work. Perhaps you can share that jar file here so that others can test it on their Mac machines?
i tried it on different machines and it did not work on a Apple Silicon (ARM64) processor machine. does this matter?
@dominopizzaaaa Was that machine using the exact JDK distribution we prescribed? If not, that could be the reason why it didn't work. Perhaps you can share that jar file here so that others can test it on their Mac machines?
yes, it was using that JDK. I have released my JAR file, @ others do help me test on your mac machines!
yes, it was using that JDK. I have released my JAR file, @ others do help me test on your mac machines!
Apple Silicon Mac users, are you able to run the above jar file? First, run the java -version
command to ensure you are using the Azul SDK we have prescribed, and then use the java -jar
command to run the jar file in the same terminal.
Hi @dominopizzaaaa, I'm a senior from a previous batch dropping in to help.
My OS details:
OS: macOS Sonoma 14.2.1 arm64
Host: MacBook Pro (14-inch, 2021)
JDK version: openjdk 17.0.11 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
i tried it on different machines and it did not work on a Apple Silicon (ARM64) processor machine. does this matter?
@dominopizzaaaa Was that machine using the exact JDK distribution we prescribed? If not, that could be the reason why it didn't work. Perhaps you can share that jar file here so that others can test it on their Mac machines?
yes, it was using that JDK. I have released my JAR file, @ others do help me test on your mac machines!
It seems to be working on my machine using java -jar papadom.jar
, I also managed to clone it and build it locally using a silicon (ARM64) Mac.
To narrow down the issue, on which OS-es did you encounter the problem on?
Hi @dominopizzaaaa, I am from your senior batch. I am able to run your JAR file using java - jar
command on my Apple Silicon Mac machine.
My OS details:
OS: macOS Sonoma 14.6.1 arm64
Host: MacBook Air (13-inch, 2022)
JDK version: openjdk version "17.0.11" 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
Hello @dominopizzaaaa! I am from your senior batch. I am also able to run your JAR file on my Apple Silicon Machine. OS Details:
OS: macOS Sonoma 14.6.1
JDK version: openjdk version "17.0.11" 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
I also cloned your master branch to test it out locally and I was able to run the app successfully without the refactoring for the Launcher class.
Hello @dominopizzaaaa! I am from your senior batch. I am also able to run your JAR file on my Apple Silicon Machine. OS Details:
OS: macOS Sonoma 14.6.1
JDK version: openjdk version "17.0.11" 2024-04-16 LTS
OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
I also cloned your master branch to test it out locally and I was able to run the app successfully without the refactoring for the Launcher class.
thanks a lot for your help!
Hi @dominopizzaaaa, I'm a senior from a previous batch dropping in to help.
My OS details: OS: macOS Sonoma 14.2.1 arm64 Host: MacBook Pro (14-inch, 2021) JDK version: openjdk 17.0.11 2024-04-16 LTS OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
i tried it on different machines and it did not work on a Apple Silicon (ARM64) processor machine. does this matter?
@dominopizzaaaa Was that machine using the exact JDK distribution we prescribed? If not, that could be the reason why it didn't work. Perhaps you can share that jar file here so that others can test it on their Mac machines?
yes, it was using that JDK. I have released my JAR file, @ others do help me test on your mac machines! my jar file
It seems to be working on my machine using
java -jar papadom.jar
, I also managed to clone it and build it locally using a silicon (ARM64) Mac.To narrow down the issue, on which OS-es did you encounter the problem on?
thank you! i had issues running it on a Apple-silicon mac machine
Hi @dominopizzaaaa, I am from your senior batch. I am able to run your JAR file using
java - jar
command on my Apple Silicon Mac machine.My OS details:
OS: macOS Sonoma 14.6.1 arm64 Host: MacBook Air (13-inch, 2022) JDK version: openjdk version "17.0.11" 2024-04-16 LTS OpenJDK Runtime Environment Zulu17.50+19-CA (build 17.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu17.50+19-CA (build 17.0.11+9-LTS, mixed mode, sharing)
thanks all for the help!
Hi all, I keep getting this error when I try to run my .jar file on a few of my friends computer:
I tried using GPT and searching online for answers, but i can't seem to solve this problem. Below is my build.gradle file, are there are issues with this file?
Thanks in advance!