JackCompiler doesn't work on Mac

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

JackCompiler doesn't work on Mac

tony10
How do I progress if I'm using a Mac? I've been trying to get it to work but it's not working. I tried jack IDE as well but it doesn't install properly on windows 7 parallel desktop.
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

ybakos
All you need is a text editor and the TECS tool suite.

I recommend Sublime Text 2 or Textmate.
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

tony10
Hey ybakos,

Thanks so much for responding! Yes I've been using a text editor, but I've been having problems running JackCompiler. The other assemblers have a GUI when opened, but Nothing happens when I open up JackCompiler.

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

Re: JackCompiler doesn't work on Mac

cadet1620
Administrator
The Jack compiler is a command line tool, not a GUI.

    JackCompiler {filename}
or
    JackCompiler {subdir}

Your executable path needs to include the directory containing the TECS tools.

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

Re: JackCompiler doesn't work on Mac

tony10
Hi cadet1620,

Thanks so much for the guidance!

I managed to use the command line, but the following error showed up:

$ java JackCompiler Square
Exception in thread "main" java.lang.NoClassDefFoundError: JackCompiler
Caused by: java.lang.ClassNotFoundException: JackCompiler
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

I read online that macs can't read .bat files, so I opened the JackCompiler.sh file in TextEdit to check things out:

#!/bin/sh
cd `dirname $0`
java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/Compilers.jar" Hack.Compiler.JackCompiler $1

I looked into the class and lib folders in the software suite, and noticed that the required .jar files were there, so I'm still looking for the fix.

Will appreciate any advice that brings this thing closer to working. Thanks again!

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

Re: JackCompiler doesn't work on Mac

ybakos
Tony, just to be clear, are you executing:

java JackCompiler Square 

Because if you are, then "yerdoinitwrong."

Simply:

JackCompiler.sh /absolute/path/to/Square

Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

tony10
Hey ybakos,

Yes, indeed I wasn't doing it right.

I just tried these two and got the following outcomes though:

$ JackCompiler.sh /absolute/path/to/Square
-bash: JackCompiler.sh: command not found

$ java JackCompiler.sh /absolute/path/to/Square
Exception in thread "main" java.lang.NoClassDefFoundError: JackCompiler/sh
Caused by: java.lang.ClassNotFoundException: JackCompiler.sh
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Tried updating Java and still the same thing; tried applying JackCompiler.sh to a .jack file and still the same thing.

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

Re: JackCompiler doesn't work on Mac

milythael
> $ JackCompiler.sh /absolute/path/to/Square
> -bash: JackCompiler.sh: command not found

Tony,

Try /absolute/path/to/JackCompiler.sh /absolute/path/to/Square.  Bash
doesn't know where your JackCompiler.sh file is, I.E. it isn't in your
path.

Sean
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

tony10
Hey Sean,

This is what I got:

$ /absolute/path/to/JackCompiler.sh /absolute/path/to/Square
-bash: /absolute/path/to/JackCompiler.sh: No such file or directory

Thanks so much for the suggestion!

I was just thinking, could the problem be because the .sh file is in a zipped folder? Nowadays, Mac OS Lion doesn't distinguish between zipped and unzipped files.

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

Re: JackCompiler doesn't work on Mac

tony10
Scratch that about the zipped files, I checked and the folder holding the .sh file has no .zip extension.

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

Re: JackCompiler doesn't work on Mac

milythael
In reply to this post by tony10
> I was just thinking, could the problem be because the .sh file is in a
> zipped folder? Nowadays, Mac OS Lion doesn't distinguish between zipped and
> unzipped files.

Yes, that could be the problem.  While the OS might not care if the
files are zipped up, the underlying tools (bash, java, etc) probably
won't read into a zipped file for you.  You should unzip the entire
package.

Sean
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

milythael
In reply to this post by tony10
> Scratch that about the zipped files, I checked and the folder holding the
> .sh file has no .zip extension.

You could also have a permissions problem.  Try the following and then
run it again.

chmod u+x /absolute/path/to/JackCompiler.sh
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

tony10
Hey Sean,

I went down to the folder holding the .sh file:

cd Downloads
cd tecs-software-suite

did these two and got the following responses:

$ chmod u+x /absolute/path/to/JackCompiler.sh
chmod: /absolute/path/to/JackCompiler.sh: No such file or directory

$ chmod u+x JackCompiler.sh
$

I then tried again, but still the same thing:

$ /absolute/path/to/JackCompiler.sh /absolute/path/to/Square
-bash: /absolute/path/to/JackCompiler.sh: No such file or directory

$ java /absolute/path/to/JackCompiler.sh /absolute/path/to/Square
Exception in thread "main" java.lang.NoClassDefFoundError: /absolute/path/to/JackCompiler/sh
Caused by: java.lang.ClassNotFoundException: .absolute.path.to.JackCompiler.sh
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

As for the zip file, I redownloaded it from the TECS webpage as a zip file, but once I opened it, it became a folder automatically. Might be a function of Mac OS.

Thanks so much for the guidance so far! Really appreciate it.

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

Re: JackCompiler doesn't work on Mac

cadet1620
Administrator
In reply to this post by tony10
tony10 wrote
This is what I got:

$ /absolute/path/to/JackCompiler.sh /absolute/path/to/Square
-bash: /absolute/path/to/JackCompiler.sh: No such file or directory
Just to be sure, you are not typing literally "/absolute/path/to/JackCompiler.sh /absolute/path/to/Square" are you?

If, for example, you put the TECS tools in /usr/tony/tecs/bin you would use "/usr/tony/tecs/bin/JackCompiler.sh" .

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

Re: JackCompiler doesn't work on Mac

tony10
Hey Mark,

Yes! How silly of me--this is my first proper attempt at using the Terminal.

Thanks so much everyone, Mark, Sean, ybakos, really really appreciate it.

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

Re: JackCompiler doesn't work on Mac

milythael
In reply to this post by tony10
> I went down to the folder holding the .sh file:
>
> cd Downloads
> cd tecs-software-suite
>
> did these two and got the following responses:
>
> $ chmod u+x /absolute/path/to/JackCompiler.sh
> chmod: /absolute/path/to/JackCompiler.sh: No such file or directory
>
> $ chmod u+x JackCompiler.sh
> $

That this command worked without an error message suggests there is a
problem with your path to the JackCompiler.sh.  chmod found it when it
was in the current directory.  From the tecs-software-suite directory,
try

$ JackCompiler.sh /path/to/Square

If that doesn't work, try

$ ls -l /path/to/Square

If ls does not find Square then your problem is with the path.

A quick read of http://www.tuxfiles.org/linuxhelp/linuxfiles.html
might help you out as well.
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler doesn't work on Mac

tony10
In reply to this post by tony10
So to sum it up for anyone who encounters this problem on a Mac:

enter into Terminal:

/Users/username/Downloads/tecs-software-suite-2/JackCompiler.sh /Users/username/Downloads/tecs-software-suite-2/Square

where username is your username, say ybakos

(you could also check up the full path by right-clicking on JackCompiler.sh > Get Info, and looking under "General:", then "Where:")

and then it should work!


Thanks again everyone. Finally have the solution, and I learnt something new today.

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

Re: JackCompiler doesn't work on Mac

tony10
And Sean, I'll definitely read up on http://www.tuxfiles.org/linuxhelp/linuxfiles.html.

Thanks so much again, really grateful for the help.

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

Re: JackCompiler doesn't work on Mac

cadet1620
Administrator
In reply to this post by tony10
To make it easier to use, you should be able to make an alias so that you don't need to type so much.

Edit /Users/username/.bashrc and add

    alias jc=/Users/username/dir-containing-tecs-tools/JackCompiler.sh

Be careful that you don't change anything else in the .bashrc file.

Restart the command shell and cd to the directory with your .jack files.  You should be able to say
    jc filename.jack

[Mac folks out there, is there an easier way to make permanent aliases?]

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

Re: JackCompiler doesn't work on Mac

Marty Billingsley
In Terminal on a Mac, you can just drag a file into the terminal window and the complete file path will appear.