Compiling .class files using terminal

Discussion in 'Mac Programming' started by Mac Player, Sep 29, 2006.

  1. Mac Player macrumors regular

    Jan 19, 2006
    Im currently using Textmate to write my java code. The only problem is that i dont know how to compile the files i create.

  2. Kunimodi macrumors member

    Sep 8, 2006
    Ashland, OR, USA
    Hi, TIA. You'll need the developer tools installed. Start and go to the directory containing the java code. Then type 'javac'. You can run java programs on the command line by typing 'java YourFile' where YourFile.class exists and has a public static main() method. Or, you can run a jar as with 'java -jar YourJar.jar' -- in that case you can also simply click on the jar file in Finder.

    To make fuller use of Textmate, you could automate the builds using Commands. You might consider using apache ant to define the build and simply build using a build.xml file.

Share This Page