cannot run JackCompiler.bat

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

cannot run JackCompiler.bat

Koen_Be3840
All the software is running very well.

But I can't get JackCompiler running.

I'm following the steps in the book (p197) but no result.

Koen

Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

cadet1620
Administrator
Koen_Be3840 wrote
All the software is running very well.

But I can't get JackCompiler running.

I'm following the steps in the book (p197) but no result.

Koen
If you are running Windows, create a file jc.cmd in C:\Windows that contains
@echo off
pushd .
call C:\nand2tetris\tools\JackCompiler.bat %cd%\%1
popd
Once you have done this, you can run the compiler by typing jc at the command prompt.
P:\TECS\projects\09\Reflect>jc Game.jack

P:\TECS\projects\09\Reflect>dir Game.*
 Volume in drive P is Data
 Volume Serial Number is 88D8-5ACE

 Directory of P:\TECS\projects\09\Reflect

05/14/2011  02:40 PM             3,719 Game.jack
11/22/2012  09:03 AM             5,880 Game.vm
               2 File(s)          9,599 bytes
               0 Dir(s)   6,244,823,040 bytes free

P:\TECS\projects\09\Reflect>cd ..

P:\TECS\projects\09>jc Reflect

P:\TECS\projects\09>dir /od Reflect\*.vm
 Volume in drive P is Data
 Volume Serial Number is 88D8-5ACE

 Directory of P:\TECS\projects\09\Reflect

11/22/2006  06:05 PM               359 Array.vm
11/22/2006  06:05 PM             5,531 String.vm
11/22/2006  06:05 PM            11,210 Screen.vm
11/22/2006  06:05 PM             1,629 Keyboard.vm
11/22/2006  06:05 PM            30,975 Output.vm
11/22/2006  06:05 PM             5,150 Math.vm
11/22/2006  06:05 PM             3,682 Memory.vm
11/22/2006  06:05 PM             1,309 Sys.vm
11/22/2012  09:04 AM             4,864 Ball.vm
11/22/2012  09:04 AM             5,880 Game.vm
11/22/2012  09:04 AM             2,807 Main.vm
11/22/2012  09:04 AM               864 Random.vm
11/22/2012  09:04 AM             3,956 Mirrors.vm
11/22/2012  09:04 AM             2,659 Target.vm
              14 File(s)         80,875 bytes
               0 Dir(s)   6,244,847,616 bytes free

This assumes that Windows is installed in its normal location and that you installed Nand2Tetris to C:\Nand2Tetris. Change file paths as required for your system.

Someone else will have to help you if you are using a Mac.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

Koen_Be3840
That did it.

Thanks again Mark
bin
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

bin
In reply to this post by cadet1620
Very useful
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

Ichiro
In reply to this post by cadet1620
Hi,

I clicked the jack compiler in the tool to open it, but the graphic did not show up. I created jc.cmd as you instructed and put a command on the command prompt as below.

D:\nand2tetris\projects\09\Square>jc SquareGame.jack

However, it returned "Not recognized as a program or batch file that can operate internal or external commands." Then I set a path of jc.cmd on the control panel and still the command prompt returned the same error.

How could I figure this out?

Ichiro
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

WBahn
Administrator
Is this on a windows machine?

Try naming your batch file "jc.bat" instead of "jc.cmd" and be sure to add the directory that it is located in to the path. You also need to be sure that you are changing the path so that it persists from one instance of the command window to the next.
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

Ichiro
Yes, it is a Windows machine.

I renamed my batch file as "jc.cmd" and checked that I added the directory where the batch file is located, but it did not work. I am sorry but I could not understand what you meant by "You also need to be sure that you are changing the path so that it persists from one instance of the command window to the next."

I tried to open the batch file "jc.cmd" by typing "start jc.cmd" on the command prompt after setting the current directory but it returned, "file not found." The files on other folders such as "FibonacciElement.asm" in the D: drive was successfully opened in the same way. So does it have something to do with C: drive?


Ichiro
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

WBahn
Administrator
Don't call the batch file ".cmd". Use a ".bat" extension.

When you change the PATH environment variable, the default is that it changes just for the current instance of the Command Window. The next time you open a Command Window it will be using the original PATH. There is an option to change the PATH for future instance of the command window as well.

What is the contents of your batch file?

Where is the batch file located?
Reply | Threaded
Open this post in threaded view
|

Re: cannot run JackCompiler.bat

Ichiro
I finally figured it out. I noticed that I have set the wrong folder in the batch file. Thank you very much for making me check the content of the batch file.

After successfully compiling the jack files to .VM files, I struggled with running the Square program. I worked it out by reading the VM emulator tutorial, which is stored in the link below.

https://www.nand2tetris.org/software

Thanks,
Ichiro