Problem with JackCompiler

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

Problem with JackCompiler

paco22dt
I have problems when I try to run the Jack Compiler.bat to compile my files .jack not really know if I'm doing it the right way. I could explain what steps to compile my files. I'm working on Windows x64.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with JackCompiler

cadet1620
Administrator
The JackCompiler runs from the command line (cmd.exe), not from a desktop shortcut or clicking on JackCompiler.bat in Explorer.

You need to add your nand2tetris\tools directory to the PATH environment variable so that Windows can find the batch file.

On Windows 7, right-click "Computer" icon and select Properties. Go to the "Advanced tab" and click "Environment Variables..."

Scroll down in the System variables list and select "Path" and click the "Edit..." button and add your nand2tetris\tools directory, followed by a ';', to the beginning of the path. Close all the dialogs and start a new Cmd window. Type "path" and you should see your directory

C:\Users\marka>path
PATH=d:\TECS\tools;c:\usr\binw;c:\python3.4;c:\python2.7; ... etc.
C:\Users\marka>

Now you should be able to use JackCompiler from the command line without needing to type the full path name

C:\Users\marka>d:

D:\>cd tecs\projects\09\Reflect

D:\TECS\projects\09\Reflect>dir *.vm
 Volume in drive D is SHAREDDATA
 Volume Serial Number is CCFB-1BE4

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

File Not Found

D:\TECS\projects\09\Reflect>JackCompiler
Compiling "D:\TECS\projects\09\Reflect"

D:\TECS\projects\09\Reflect>dir *.vm
 Volume in drive D is SHAREDDATA
 Volume Serial Number is CCFB-1BE4

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

04/10/2015  07:18 PM             5,197 Ball.vm
04/10/2015  07:18 PM             6,481 Game.vm
04/10/2015  07:18 PM             6,975 Main.vm
04/10/2015  07:18 PM             3,687 Mirrors.vm
04/10/2015  07:18 PM               864 Random.vm
04/10/2015  07:18 PM             2,659 Target.vm
               6 File(s)         25,863 bytes
               0 Dir(s)  12,094,406,656 bytes free

D:\TECS\projects\09\Reflect>JackCompiler /?
Usage:
    JackCompiler              Compiles all .jack files in the current
                              working directory.
    JackCompiler DIRECTORY    Compiles all .jack files in DIRECTORY.
    JackCompiler FILE.jack    Compiles FILE.jack to FILE.vm.

D:\TECS>

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: Problem with JackCompiler

paco22dt
Thanks for the answer. I've managed to compile my files but .vm .jack files are not generated. The compilation does not return me any error. Deputy Main text in the file.
class Main {  
        function void main() {
                do Output.printString("HelloWorld");
                do Output.println();
        return;
        }
}
Reply | Threaded
Open this post in threaded view
|

Re: Problem with JackCompiler

cadet1620
Administrator
Are you using Windows 7 or Windows 8?

In cmd.exe, in the directory with you .jack sources, execute

path
dir *.jack *.vm
JackCompiler
dir *.vm

Post a screenshot or copy of cmd.exe display showing all the messages.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: Problem with JackCompiler

pgqueme
In reply to this post by paco22dt
Paquini!

You should copy the bin folder, the JackCompiler.bat and JackCompiler.sh files in the folder where your files will be compiled, also the files in the OS folders (in tools). Then, you just have to run it and it will compile all the .jack files, creating new .vm files. No need to go into the windows command prompt (in my case, win8).

Winter is coming.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with JackCompiler

cadet1620
Administrator
Another thing that you can do (tested on Windows XP and 7, I don't have 8) is to create a shortcut to Compiler.bat in the directory with your sources. Use Explorer to right-click and drag Compiler.bat from nand2tetris\tools into your source directory and select "Create Shortcut Here". You must then modify the shortcut's properties to clear the "Start In" value.

You can run this new shortcut to compile your files. The major problem with this is that you cannot see any errors generated by the compiler. You can edit the JackCompiler.bat file to add a "pause" command as the last line, then the window won't automatically close after compiling.

--Mark

shortcut properties dialog
Reply | Threaded
Open this post in threaded view
|

Re: Problem with JackCompiler

dannyrose42
This just worked for me on Windows 7. Thank you.