Open qjie7 opened 5 years ago
Hi QJ,
Did not come across this issue myself but I think this stackoverflow post would help you streamline your debugging!
https://stackoverflow.com/questions/2861592/possible-to-run-jar-file-on-any-os
Thank you for the response. I will wait for my team member to try out the suggestions provided. Thank you.
Is the Java installed Java from Oracle or OpenJDK?
Is the Java installed Java from Oracle or OpenJDK?
hi , i believe should be from Oracle site
Ok, try to install OpenJDK. Follow the steps below
Download openJDK 11 here https://jdk.java.net/java-se-ri/11
Install openJDK following these instructions https://stackoverflow.com/questions/52511778/how-to-install-openjdk-11-on-windows
go to your command prompt and type in 'java -version' and make sure it is showing OpenJDK11
Then try to run your jar file again.
If not, maybe you can give me a link to your jar? I will try to run it on my computer.
Hi, can you type in java -version into your terminal and tell me what you see
Here you go. I will try to install OpenJDK11 after lecture :D thank you so much
If you are still facing the same issue, I suggest that you check what Java version (8,11, OpenJDK, Java SE) you packaged and built the JAR file with. Make sure that the system you want to run the JAR file on is also running the same version of Java as the system that you packaged your JAR file with, regardless of the platform.
If you had followed the build.gradle file dependencies from any of the reference repos (e,g addressbook), the packaging and building of the JavaFX should be correct because it installs the libraries for all the platforms.
If you used the gradle plugin, it should be the same case.
Try including this if you have not in your build.gradle file
sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
The issue for projects with a GUI utilizing java FX based implementation require this to be added in the dependency under the build.gradle to make it work on other Operating Systems. Created on Win and tested it on a Mac and it works. dependencies { String javaFxVersion = '11' 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' . . . . }
Goes on to prove most of you didn't bother to read https://github.com/nusCS2113-AY1920S1/forum/issues/65 😜
Goes on to prove most of you didn't bother to read #65 😜
oops! totally forgot about this issue. Thanks prof!
reopening this a PSA
Hi we have tried the solution posted in #65 but our team is still having issues running the jar on each other's OS. A jar file built on Windows only works on a windows machine, likewise for OSx. We tried building a jar on both OSes and running it on each other's OS. This is the error output when running the jars.
It seems that only the first line of error output is any different. Built on OSx, run in Windows:
Built on Windows, run in OSx:
This is our java versions: Windows: OSx:
This is our build.gradle file.
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
checkstyle {
toolVersion ='8.23'
}
shadowJar {
archiveBaseName = "eggventory"
archiveVersion = "1.3.1"
archiveClassifier = null
archiveAppendix = null
}
group 'seedu.eggventory'
version '0.1.0'
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.0'
String javaFxVersion = '11'
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'
}
javafx {
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
test {
useJUnitPlatform()
}
repositories {
mavenCentral()
}
application {
// Change this to your main class.
mainClassName = "eggventory.Eggventory"
}
run {
standardInput = System.in
}
Hi you have to remove the javafx {...} portion! This helped mine!
Get Outlook for iOShttps://aka.ms/o0ukef
From: Dana Poon notifications@github.com Sent: Thursday, November 7, 2019 3:31:23 PM To: nusCS2113-AY1920S1/forum forum@noreply.github.com Cc: Sai Ganesh Suresh e0310898@u.nus.edu; Comment comment@noreply.github.com Subject: Re: [nusCS2113-AY1920S1/forum] Open the same JAR in Window, Mac and Linux Platforms
Hi we have tried the solution posted in #65https://github.com/nusCS2113-AY1920S1/forum/issues/65 but our team is still having issues running the jar on each other's OS. A jar file built on Windows only works on a windows machine, likewise for OSx. We tried building a jar on both OSes and running it on each other's OS. This is the error output when running the jars.
It seems that only the first line of error output is any different. Built on OSx, run in Windows: [image]https://user-images.githubusercontent.com/42791813/68368415-fcf47480-0172-11ea-9179-a35e272f5782.png
Built on Windows, run in OSx: [WhatsApp Image 2019-11-07 at 3 23 58 PM (1)]https://user-images.githubusercontent.com/42791813/68368375-e5b58700-0172-11ea-9215-5e27824c4863.jpeg
This is our java versions: Windows: [image] https://user-images.githubusercontent.com/42791813/68366675-e0563d80-016e-11ea-8230-c4917324e466.png OSx: [WhatsApp Image 2019-11-07 at 3 23 58 PM] https://user-images.githubusercontent.com/42791813/68368309-bdc62380-0172-11ea-8746-9760217669bb.jpeg
This is our build.gradle file.
plugins { id 'java' id 'application' id 'checkstyle' id 'com.github.johnrengelman.shadow' version '5.1.0' id 'org.openjfx.javafxplugin' version '0.0.7' }
checkstyle { toolVersion ='8.23' }
shadowJar { archiveBaseName = "eggventory" archiveVersion = "1.3.1" archiveClassifier = null archiveAppendix = null } group 'seedu.eggventory' version '0.1.0'
dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.5.0' String javaFxVersion = '11'
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'
}
javafx { version = "11.0.2" modules = [ 'javafx.controls', 'javafx.fxml' ] }
test { useJUnitPlatform() }
repositories { mavenCentral() }
application { // Change this to your main class. mainClassName = "eggventory.Eggventory" }
run { standardInput = System.in }
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/nusCS2113-AY1920S1/forum/issues/84?email_source=notifications&email_token=AKFWHRR37BLYG5PROQAUONTQSO74XA5CNFSM4JHISFR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDLPRJQ#issuecomment-550959270, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKFWHRUIQ5JMCTZO2J2OWKDQSO74XANCNFSM4JHISFRQ.
That worked. Thanks!
Hi all , this happened to my group after one of our only window user tried to open jar file today. Did anybody face the same problem before ? It will be great to share your experience here while i continue searching for an answer now.