How to compile Java source code from the CLI
Table of Contents
1 Purpose and Disclaimer
This was made for fellow classmates of CSE2011 because people were having trouble compiling without an IDE. These are just my humble opinions. I do not speak for the department (York University, Computer Science and Engineering Department) or the Professor (Professor J. Elder) nor does this guide come with any warranty. It is simply a way that worked for me. Lastly, please excuse any typos, I did this in a rush. ;)
2 Instruction
2.1 Creating the package folder
Make a directory with the same name as the package name
mkdir A1Q1
Get the files from the course website
wget http://www.cse.yorku.ca/course/2011/assignments/assignment%201/Q1/SparseNumericElement.java
Or move them if you already have them
mv olderdir/SparseNumericElement.java A1Q1/
2.2 Compile ALL Files
Use * as a universal selector to compile all files. Only compiling
the tester didn't work for me.
cd A1Q1 javac *.java
2.3 Run the Java code
You need to go to the parent directory of the package (i.e. A1Q1).
cd ..
To run the test program, you have to include the package name, followed by a dot, and then the program name.
java A1Q1.testSparseNumericVector
Done!
I was able to use tab completion in my shell, but this may not work for everyone. In case it does, to save time, do:
java A1Q1.test[tab-key]
3 Good Luck on the assignment!
Date: 2012-01-19 21:12:23 EST
HTML generated by org-mode 6.33x in emacs 23