nus-cs2113-AY2324S1 / forum

0 stars 0 forks source link

Ask for help to run jar file #28

Open J-Y-Yan opened 1 year ago

J-Y-Yan commented 1 year ago

Hello, can anyone help me run my jar file on your machine? I am afraid the teaching team cannot run my file.

Please refer to the following link for the file: https://drive.google.com/file/d/1wxOmkzPWCbn3q7VeQW6uB_LjxpJJjWoa/view?usp=sharing

Thanks for your help!!! I need to ensure the validity of the file before launching it.

skylee03 commented 1 year ago

Your project works on my Windows device.

J-Y-Yan commented 1 year ago

Thank you!!! it's great to hear from you.

skylee03 commented 1 year ago

I just tested it under Linux and found that it doesn't create and read files properly. The error message is as follows:

Exception in thread "main" java.nio.file.NoSuchFileException: data/taskList.txt
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
    at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
    at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
    at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
    at java.base/java.nio.file.Files.size(Files.java:2381)
    at fileIO.FileIO.clearData(FileIO.java:71)
    at fileIO.FileIO.outputFileInitialization(FileIO.java:35)
    at Oriento.Oriento.main(Oriento.java:29)

You need to change all "\\" to "/" in the file paths in FileIO.java. The former only works on Windows, while the latter works on all platforms.

J-Y-Yan commented 1 year ago

Thank you so much! I have just corrected this issue.

skylee03 commented 1 year ago

I just re-tested the latest version under Linux and now it creates and reads files properly.

mtyang@academy11:~/Documents$ java -jar ip.jar
Hello! I'm Oriento.
What can I help you?
todo fdskjsdf
Got it. I've added this task:
[T][ ] fdskjsdf
Now you have 1 tasks in the list.
================================================
list
1. [T][ ] fdskjsdf
================================================
bye
Bye. Hope to see you again soon!
================================================
mtyang@academy11:~/Documents$ java -jar ip.jar
Hello! I'm Oriento.
What can I help you?
list
1. [T][ ] fdskjsdf
================================================
bye
Bye. Hope to see you again soon!
================================================
J-Y-Yan commented 1 year ago

Great! Thanks a lot for your support.