'How to run multiple java class files from command prompt?
I have multiple java files in a single directory that are related to a single program (Main). I have been using the following in the command prompt,
javac -cp . game/textbased/*.java
java -cp . game/textbased/Main
All related files are in a package called game.textbased. The parent folder series is textbasedgame/src/game/textbased.
I am not sure what is going wrong, the java files seem to compile as nessessary, however, when I try to run I get the following:
Exception in thread "main" java.io.FileNotFoundException: items.dat (The system cannot find the file specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:111)
at java.base/java.io.FileReader.<init>(FileReader.java:60)
at game.textbased.WonderLand.loadItems(WonderLand.java:310)
at game.textbased.WonderLand.initGame(WonderLand.java:63)
at game.textbased.WonderLand.<init>(WonderLand.java:24)
at game.textbased.Main.main(Main.java:6)
I am really not sure what is going wrong, and how to run the files from here. I have read other stack overflow inqueries of a similar nature, and generally they say to go from a higher directory but that has not been working for me. I tried going from outside src, or from within the textbased folder, but only going from within the src folder has given me this particular error.
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
