Compiling .class files using terminal

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

  1. Mac Player macrumors regular

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

    TIA
     
  2. Kunimodi macrumors member

    Joined:
    Sep 8, 2006
    Location:
    Ashland, OR, USA
    #2
    Hi, TIA. You'll need the developer tools installed. Start Terminal.app and go to the directory containing the java code. Then type 'javac YourFile.java'. 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