Quantcast

CPUEmulator is not working

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CPUEmulator is not working

RahibaSinz
This post was updated on .
The CPUEmulator is not working.It shows java NULL pointer exception as well
as missing java class. what should I do now?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

ivant
Please post more info. Like the exact command line you're using, the operating system and the full error message that you're getting.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

rahiba
t12030@debian:~$ cd Desktop
it12030@debian:~/Desktop$ cd nand2tetris
it12030@debian:~/Desktop/nand2tetris$ cd tools
it12030@debian:~/Desktop/nand2tetris/tools$ ls
Assembler.bat  builtInVMCode      HardwareSimulator.sh  TextComparer.bat
Assembler.sh   CPUEmulator.bat      JackCompiler.bat    TextComparer.sh
bin       CPUEmulator.sh      JackCompiler.sh    VMEmulator.bat
builtInChips   HardwareSimulator.bat  OS    VMEmulator.sh
it12030@debian:~/Desktop/nand2tetris/tools$ sh CPUEmulator.sh
it12030@debian:~/Desktop/nand2tetris/tools$ Unexpected Error: null
java.lang.NullPointerException
        at java.io.File.<init>(File.java:239)
        at Hack.Controller.HackController.loadWorkingDir(Unknown Source)
        at Hack.Controller.HackController.<init>(Unknown Source)
        at Hack.Controller.HackApplication.createController(Unknown Source)
        at Hack.Controller.HackApplication.<init>(Unknown Source)
        at Hack.CPUEmulator.CPUEmulatorApplication.<init>(Unknown Source)
        at CPUEmulatorMain.main(Unknown Source)

  while loading cpuemulator this error occured......please give us a solution .
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

ybakos
Instead of sh CPUEmulator.sh can you please try just ./CPUEmulator.sh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

ivant
ybakos wrote
Instead of sh CPUEmulator.sh can you please try just ./CPUEmulator.sh

To do that, you first have to make it executable: chmod +x *.sh. But I don't think this is the problem. For me it works fine both ways.

Please, run it with bash -x CPUEmulator.sh and post what it logs. Here is what I see on my machine:

$ bash -x CPUEmulator.sh 
+ unset CDPATH
++ test -L CPUEmulator.sh
++ echo CPUEmulator.sh
+ script=CPUEmulator.sh
+ dir=/home/ivan/src/my/n2t/nand2tetris/tools
++ dirname CPUEmulator.sh
+ cd .
+ '[' '(' 0 -gt 1 ')' -o '(' '' = -h ')' -o '(' '' = --help ')' ']'
+ '[' 0 -eq 0 ']'
+ java -classpath :bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar CPUEmulatorMain

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

rahiba
builtInChips   HardwareSimulator.bat  OS                    VMEmulator.sh
student@debian:~/Desktop/nand2tetris/tools$ bash -x CPUEmulator.sh
+ unset CDPATH
++ test -L CPUEmulator.sh
++ echo CPUEmulator.sh
+ script=CPUEmulator.sh
+ dir=/home/student/Desktop/nand2tetris/tools
++ dirname CPUEmulator.sh
+ cd .
+ '[' '(' 0 -gt 1 ')' -o '(' '' = -h ')' -o '(' '' = --help ')' ']'
+ '[' 0 -eq 0 ']'
+ java -classpath :bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar CPUEmulatorMain
student@debian:~/Desktop/nand2tetris/tools$ Unexpected Error: null
java.lang.NullPointerException
        at java.io.File.<init>(File.java:239)
        at Hack.Controller.HackController.loadWorkingDir(Unknown Source)
        at Hack.Controller.HackController.<init>(Unknown Source)
        at Hack.Controller.HackApplication.createController(Unknown Source)
        at Hack.Controller.HackApplication.<init>(Unknown Source)
        at Hack.CPUEmulator.CPUEmulatorApplication.<init>(Unknown Source)
        at CPUEmulatorMain.main(Unknown Source)

  Emulator is first loaded and then disappears.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

ivant
Aha! I should've spotted this with the previous exception log!

rm ~/Desktop/nand2tetris/tools/bin/CPU\ Emulator.dat

and try again.

This file contains the directory of the last open project. The CPU emulator tries to open it and obviously fails if it doesn't exist.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

rahiba
hwproject@debian:~$ rm ~/Desktop/nand2tetris/tools/bin/CPU\Emulator.dat
rm: cannot remove `/home/hwproject/Desktop/nand2tetris/tools/bin/CPUEmulator.dat': No such file or directory
hwproject@debian:~$

what should i do now?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

cadet1620
Administrator
The filename has a space in it.  You need to type a space after the \.
    rm ~/Desktop/nand2tetris/tools/bin/CPU\ Emulator.dat
                                           ^__space
Alternatively, you should be able to use a ? wildcard character for the space.
    rm ~/Desktop/nand2tetris/tools/bin/CPU?Emulator.dat

--Mark
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

rahiba
oh my God...
Thank you all for helping us to do our project.It worked.We don't know how to express  our joy :D .
Again  thankyou somuch.
Loading...