EDIT: Long story short, the compiler has trouble working with spaces in directory names. The zip file for project 9 creates a directory called "project 09", so be sure to change this before compilation!
I'm having a lot of trouble getting the supplied compiler to run through the terminal on a mac. No matter what input I give the compiler (running JackCompiler.sh), it prints out the contents of bin/help/compiler.txt followed by "Usage: java JackCompiler <Jack-dir or Jack-file-name>".
This is quite a confusing message as the shell file includes code to run the compiler's java class files inside the bin/lib/Compilers.jar file. There is no JackCompiler class file inside the tecs-software-suite-2.5 directory, making "java JackCompiler Jack-dir-path" invalid.
I've checked that the inputs are either valid directories or individual .jack files and tried using absolute paths. I've also unsuccessfully tried manually running the classes in the jar file. I took a look at the thread
which just explains how to run a shell file on a different directory. As a last resort, I re-downloaded the software suite, but got the same results.
Here's the exact output given when I run the shell file as described. The same output occurs when using absolute paths. ("project 09" is a directory in the same folder as tecs-software-suite-2.5, Square is a directory in project 09 holding several .jack files)
I just want to be able to compile files/directories not in the same working directory.
EDIT: Moved some files around and it looks like the compiler has trouble interpreting spaces or the space escape sequence character in directory names. This is slightly problematic, since the default download folder is called "project 09"! Oh well, easy enough to fix.
I just checked the project 9 page in the study plan. It says:
"To help you get started, we provide a sample Jack program, stored in project 09.zip. Start by creating a directory named projects/09 on your computer, and extract this zip file into it (preserving the directory structure embedded in the zip file)."
Spaces in file names are generally bad news for command line programs.
I hate to disagree with anybody using a sliderule as their icon and a handle commemorating my first computer, but it's pretty common these days to handle spaces in directory names (and file names) properly in command-line programs, including complex bash scripts and such. With filename completion in most major shells, the quoting is even applied automatically at the user level.
In my case, I've wasted over a day trying to get the dratted compiler to run or at least produce a meaningful error message. If that *is* my problem I'm kinda in a bind -- the space in the path that may be causing me trouble is coming from %CLASSPATH%, which points to C:\Program Files (x86)\Java\jre7\lib (two spaces in the first path component there -- which is the standard installation location for Java on Windows). So, are you saying that this compiler won't function on a Windows system with Java installed in the default location? That seems kind of a problem to me. (Yes, of course I can copy it elsewhere and try that out. If that *is* the problem, then I have to do a special modification on the classroom computer each week before teaching the rest of this, since we're using Jack for the rest of the term.)
The issue is not about executing Java, irrespective of its installation location.
This thread is about how the JackCompiler script may need some massaging to handle the compilation of .jack files that exist in a directory hierarchy that includes spaces. I believe this may have been fixed.
In my case, I've wasted over a day trying to get the dratted compiler to run or at least produce a meaningful error message. If that *is* my problem I'm kinda in a bind -- the space in the path that may be causing me trouble is coming from %CLASSPATH%, ...