Beginner here, I get an error code whenever I try to run this small part of my code. Could someone help, I am trying to load an integer in string form loaded in hs.txt and only replace it when the highscore in the session is higher.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at processing.core.PApplet.runSketch(PApplet.java:10845)
at processing.core.PApplet.main(PApplet.java:10613)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at processing.core.PApplet.runSketch(PApplet.java:10839)
... 1 more
Caused by: java.lang.NullPointerException
RuntimeException: java.lang.reflect.InvocationTargetException
at sketch_191229b.<init>(sketch_191229b.java:21)
... 6 more
Okay, now I have a different issue; Whenever saveStrings(“hs.txt”, hs); happens, my game crashes and I get the NullPointerException error. Is it because the data from the .txt file is being read and I can’t edit it while its being read?
Okay, I reworked things around a while ago to experiment and now I can read what is in the .txt file, but I still cannot change what is written inside. This is part of a highscore system for a larger game btw