Tennessene / jDOSBox

Java x86 emulator based on DOSBox
9 stars 1 forks source link

solving build errors: two missing symbols and one uninitialized variable #14

Open reeskm opened 2 weeks ago

reeskm commented 2 weeks ago

I'm having minor build errors with a 'mvn clean install'

README.md states: jDOSBox can be used with Java 8 or higher, just make sure threshold under the compiler section of the config is set to 0 I've grep'd and find'd for 'threshold' and 'config' and can't find where to set the threshold.

mvn -v outputs: Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39) Maven home: /Users/rees/src/apache-maven-3.8.8 Java version: 1.8.0_392-internal, vendor: OpenLogic-OpenJDK, runtime: /Library/Java/JavaVirtualMachines/openlogic-openjdk-8.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"

Tennessene commented 1 week ago

So there should be a config file in a folder called .jdosbox in the same directory as the Jar. Have you found that?

reeskm commented 1 week ago

no, I don't have any .jdosbox folders in my build tree. So the actual problem are these errors:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] jdosbox-root                                                       [pom]
[INFO] jdosbox                                                            [jar]
[INFO] jdosbox-pcap                                                       [jar]
[INFO] jdosbox-win                                                        [jar]
[INFO] launcher                                                           [jar]
[INFO] 
[INFO] ------------------< com.acclash.jdosbox:jdosbox-root >------------------
[INFO] Building jdosbox-root 0.74.31-SNAPSHOT                             [1/5]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jdosbox-root ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jdosbox-root ---
[INFO] Installing /Users/rees/src/jDosbox/pom.xml to /Users/rees/.m2/repository/com/acclash/jdosbox/jdosbox-root/0.74.31-SNAPSHOT/jdosbox-root-0.74.31-SNAPSHOT.pom
[INFO] 
[INFO] --------------------< com.acclash.jdosbox:jdosbox >---------------------
[INFO] Building jdosbox 0.74.31-SNAPSHOT                                  [2/5]
[INFO]   from jdosbox/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jdosbox ---
[INFO] Deleting /Users/rees/src/jDosbox/jdosbox/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jdosbox ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jdosbox ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 308 source files to /Users/rees/src/jDosbox/jdosbox/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/misc/setup/Section.java: Some input files use unchecked or unsafe operations.
[WARNING] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/misc/setup/Section.java: Recompile with -Xlint:unchecked for details.
[INFO] 2 warnings 
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/cpu/CPU.java:[3002,13] variable pressed might not have been initialized
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/gui/MainFrame.java:[169,13] cannot find symbol
  symbol:   class PrintStream
  location: class jdos.gui.MainFrame
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/gui/MainFrame.java:[169,43] cannot find symbol
  symbol:   class PrintStream
  location: class jdos.gui.MainFrame
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/gui/MainFrame.java:[169,59] cannot find symbol
  symbol:   class OutputStream
  location: class jdos.gui.MainFrame
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for jdosbox-root 0.74.31-SNAPSHOT:
[INFO] 
[INFO] jdosbox-root ....................................... SUCCESS [  0.661 s]
[INFO] jdosbox ............................................ FAILURE [ 14.131 s]
[INFO] jdosbox-pcap ....................................... SKIPPED
[INFO] jdosbox-win ........................................ SKIPPED
[INFO] launcher ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.034 s
[INFO] Finished at: 2024-09-08T00:58:26-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jdosbox: Compilation failure: Compilation failure: 
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/cpu/CPU.java:[3002,13] variable pressed might not have been initialized
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/gui/MainFrame.java:[169,13] cannot find symbol
[ERROR]   symbol:   class PrintStream
[ERROR]   location: class jdos.gui.MainFrame
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/gui/MainFrame.java:[169,43] cannot find symbol
[ERROR]   symbol:   class PrintStream
[ERROR]   location: class jdos.gui.MainFrame
[ERROR] /Users/rees/src/jDosbox/jdosbox/src/main/java/jdos/gui/MainFrame.java:[169,59] cannot find symbol
[ERROR]   symbol:   class OutputStream
[ERROR]   location: class jdos.gui.MainFrame
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :jdosbox
reeskm commented 1 week ago

After easily fixing the last two build errors by importing java.io.PrintStream and java.io.OutputStream in MainFrame.java, I'm left with the final build error which I don't have enough java experience to fix:

A grep finds the lines in question:

jdosbox/src/main/java/jdos/cpu/CPU.java:2911:    final static private Mapper.MAPPER_Handler CPU_CycleIncrease = pressed -> {
jdosbox/src/main/java/jdos/cpu/CPU.java:2912:        if (!pressed) return;
jdosbox/src/main/java/jdos/cpu/CPU.java:2935:    final static private Mapper.MAPPER_Handler CPU_CycleDecrease = pressed -> {
jdosbox/src/main/java/jdos/cpu/CPU.java:2936:        if (!pressed) return;

Because of the complicated assignment in the function definition, I'm not sure how to easily assign the variable pressed a default value. I'm also not sure what if pressed is even declared anywhere. Hope you can help me out!