Skip to content

Instantly share code, notes, and snippets.

@tgab
Created March 5, 2010 21:13
Show Gist options
  • Save tgab/323155 to your computer and use it in GitHub Desktop.
Save tgab/323155 to your computer and use it in GitHub Desktop.
Some notes on command-line compiling for java.
Here's my directory structure
project06/
add/ ...
assembler/
Assembler.java
Code.java
Parser.java
SymbolTable.java
max/ ...
pong/ ...
rect/ ...
All my java classes are in the same package (i.e. I have the statement "package assembler;"
at the beginning of each file).
The Assembler.java file makes use of the other .java files (i.e. At the beginning of
Assembler.java I specify "import assembler.Code; import assembler.Parser; ..."
To compile all the classes you must be in the directory above the package (i.e. in the
project06 directory) so that dependencies can be found.
Command to compile files:
javac assembler/*.java
(will create .class files)
To run program (assuming that Assembler.java has main() and it accepts an asm filename argument)
java assembler/Assembler <filename>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment