How do you program java on mac?

Posted:
in Genius Bar edited January 2014
Hello, my friend is in java class and has an ibook, they are required to do some java programming (no duh ). Anyways, we have no clue how to do so, someone said something about using the Terminal to do programming but so far we do not know how to do it... Anyone here know how to do so?

Comments

  • Reply 1 of 7
    airslufairsluf Posts: 1,861member
    Kickaha and Amorph couldn't moderate themselves out of a paper bag. Abdicate responsibility and succumb to idiocy. Two years of letting a member make personal attacks against others, then stepping aside when someone won't put up with it. Not only that but go ahead and shut down my posting priviledges but not the one making the attacks. Not even the common decency to abide by their warning (afer three days of absorbing personal attacks with no mods in sight), just shut my posting down and then say it might happen later if a certian line is crossed. Bullshit flag is flying, I won't abide by lying and coddling of liars who go off-site, create accounts differing in a single letter from my handle with the express purpose to decieve and then claim here that I did it. Everyone be warned, kim kap sol is a lying, deceitful poster.



    Now I guess they should have banned me rather than just shut off posting priviledges, because kickaha and Amorph definitely aren't going to like being called to task when they thought they had it all ignored *cough* *cough* I mean under control. Just a couple o' tools.



    Don't worry, as soon as my work resetting my posts is done I'll disappear forever.

  • Reply 2 of 7
    baumanbauman Posts: 1,248member
    The Terminal can be daunting, but it isn't all that hard. You really only need to know about four commands. An IDE isn't a bad idea to begin with, but I never liked the way they felt.



    First, I use SubEthaEdit to create the plain text .java source files.



    Now, if you've never used the terminal before, it'd be a good time to get acquainted. The Terminal is kinda like the finder... you use it to move around the file system and run other programs from within it. Some simple commands include:

    ls - lists the contents of the current folder (should be your home folder at the beggining of a session)

    cd - this is what you do to change directory. Typing "cd /" will go to the root level, and "cd ~" goes to your home.

    cat - this will display the contents of a (text) file in the terminal.



    and, perhaps the most essential program is "man". This is how you learn how things work. Type "man ls" or "man man" to get an idea of how these things work. They're kinda obtuse but if you start reading them you get the gist.



    Now, for the java part. Just "cd" to the directory where all your project files are, and then type "javac filename.java". It will take a sec, and then it puts the compiled .class files in the same directory. Or, if you're working with more than one class, just type "javac *.java" to compile all files in the directory whose name is java.



    If you want more information type "man javac" or simply "man java" to see everything java related on the machine.
  • Reply 3 of 7
    grafgraf Posts: 22member
    Apple supply a Java capable IDE with all new iBooks, called XCode. There's a website for it here:-

    http://www.apple.com/macosx/features/xcode/



    You can also download it for free from the apple developer site, but the installer for it is probably already on the iBook. I think it's in /Developer, but I can't remember exactly.



    Edit: The installer should be in /Applications/Installers/Developer Tools/ if the iBook has OS X 10.3 (Panther) on it.
  • Reply 4 of 7
    gongon Posts: 2,437member
    For learning to program, I'd start with just a text editor and compile+run from the command line. That way you learn what actually happens in the process and later on you understand thoroughly what different power tools (like an IDE) can do for you. If you have only learned to work in an IDE, it's a huge (psychological and practical) obstacle if you'd ever want to go without it, or move to another IDE. I know because that's the way I initially learned to code, and it was a pain when I had to learn the basics in school afterwards when I though I knew a lot already. (I didn't.) Many people never use an IDE even on advanced level, because with enough skill you can fuse together individual tools like a powerful text editor (emacs, vim), build control (make, ant) and others to get something that is roughly the equivalent of an IDE. However you learn, you need to know how to use Terminal (or rather, how to use a shell, Terminal/iTerm/xterm are just window frontends). Basic shell use is much easier than programming, anyway, so you shouldn't have much trouble with it.
    Quote:

    Miyamoto Musashi - The Book of Five Rings (1643)

    You should not have too much fondness for a particular weapon, or anything else for that matter.



  • Reply 6 of 7
    great! I'll tell my friend tomorrow. Ironically, the java teacher uses a 15" powerbook full time, but has no clue how to run java on it
  • Reply 7 of 7
    airslufairsluf Posts: 1,861member
    Kickaha and Amorph couldn't moderate themselves out of a paper bag. Abdicate responsibility and succumb to idiocy. Two years of letting a member make personal attacks against others, then stepping aside when someone won't put up with it. Not only that but go ahead and shut down my posting priviledges but not the one making the attacks. Not even the common decency to abide by their warning (afer three days of absorbing personal attacks with no mods in sight), just shut my posting down and then say it might happen later if a certian line is crossed. Bullshit flag is flying, I won't abide by lying and coddling of liars who go off-site, create accounts differing in a single letter from my handle with the express purpose to decieve and then claim here that I did it. Everyone be warned, kim kap sol is a lying, deceitful poster.



    Now I guess they should have banned me rather than just shut off posting priviledges, because kickaha and Amorph definitely aren't going to like being called to task when they thought they had it all ignored *cough* *cough* I mean under control. Just a couple o' tools.



    Don't worry, as soon as my work resetting my posts is done I'll disappear forever.

Sign In or Register to comment.