Basic Java stuff in Project Builder

Discussion in 'Mac Apps and Mac App Store' started by jibberia, Sep 30, 2003.

  1. jibberia macrumors newbie

    Joined:
    Sep 30, 2003
    #1
    Hello all-

    I'm a student in a java programming class, and being that it's a class in the CS department, the prof and almost all the students use PCs and a certain freeware compiler called JCreator LE (it's a strange little island of PC users in a school full of mac users).

    I've used TextEdit to write programs and javac in the Terminal to compile them, but that really sucks. I want to use Project Builder. I've downloaded, installed, and messed around with it quite a bit. I got it to compile a program of mine once but it was unbelievably overcomplicated.

    Can anyone help me with compiling and running very simple java applications? Here's one I've pasted from our class website:

    public class IntLong
    {
    public static void main( String args[] )
    {

    int integer1;
    long integer2;

    integer1 = 2147483647;
    integer2 = 2147483647;

    System.out.println ("integer1: " + integer1);
    integer1 = integer1 + 1;
    System.out.println ("integer1: " + integer1);

    System.out.println ("integer2: " + integer2);
    integer2 = integer2 + 1;
    System.out.println ("integer2: " + integer2);



    }
    }

    It just shows the limits of ints.

    I'd be eternally grateful if anyone could help!

    Thanks!

    -Kevin
     
  2. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #2
    I use jGrasp from Auburn Univ. for all of my Java coding because ProjectBuilder is a pain for anything but C, C++, or Objective-C.

    It makes it simple to create source, compile source, package applications, and run them, of course.

    It not only runs on Macs, but Windows and various UNIX varieties.
     
  3. grapes911 Moderator emeritus

    grapes911

    Joined:
    Jul 28, 2003
    Location:
    Citizens Bank Park
    #3
    ProjectBuilder is a great program, but stick with the terminal. I program in the pb editor and then compile in the terminal. Trust me, you are better off this way. I find that pb has way too many extas that tend to get in the way of my java programs.
     
  4. jaykk macrumors 6502a

    Joined:
    Jan 5, 2002
    Location:
    CA
    #4
    IDE are better if you have a big project

    IDE is useful for big projects with so many dependencies. For simple programs, you better of using a texteditor, and terminal.
    But if you really wanna try IDE, its very simple

    File -> New Project -> Java -> Java Tool -> <enter project name (eg: IntLong) -> Finish.

    You will get an empty project with "Hello World' ..replace it with your code, click on buld&run(3rd Icon).. there you have it.

    You can't get easier than that

    here is the pic

    edit: replaced pdf with jpg
     

    Attached Files:

  5. jibberia thread starter macrumors newbie

    Joined:
    Sep 30, 2003
    #5
    Jaykk - that was exactly what I was looking for, but it won't work for me. I created a java tool and left the Hello World app there, and it returned the "no executable present to launch" error.

    Hmm... I guess this error is really my problem. I keep getting it no matter what I try...

    thanks though! Any other ideas?
     
  6. Gaz macrumors regular

    Joined:
    Aug 15, 2002
    Location:
    London, UK
    #6
    Personally I'd recommend a program called eclipse.

    http://www.eclipse.org/

    The download:

    http://download.eclipse.org/downloa...opFile=eclipse-SDK-3.0M3-macosx-carbon.tar.gz

    Why??

    Well:

    1. It's free...always a big plus in anyones book.

    2. It's supported by some of the largest companies around and is fast becoming one of ides to use (with the other major player being JBuilder and to a lesser extent IntelliJ IDEA).

    3. It's very easy to use and provides a nice debugger to make coding easy and also has extra things like syntax highlighting and code completion.

    On the down side if you're learning, code completion can make you lazy as you don't need to remember the programming syntax..it does it for you.

    Probably the best reason to use it though is that it is a tool that lots of the top developers will use so you will become familiar with a industry leading tool; very valuable when you start work and have to use these things. It's worth spending a day having a play with it and seeing what you think.
     
  7. X-Baz macrumors member

    Joined:
    Dec 11, 2002
    Location:
    Leeds, England
    #7
    Simple Java IDE for learning ...

    For learning java, I recommend DrJava (from sourceforge.net) - it's small (so not a resource hog like Eclipse or Netbeans), let's you play around interactively with an interpreter (so you can try before you compile) and also supports good practice like unit testing and javadocs. And you don't need to muck about setting up "projects" or filesystems and the like.
     
  8. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #8
    Hey guys,

    I second the vote for Eclipse. I use it now on my PC and I intend to download it to the Mac as soon as my Powerbook arrives (tomorrow!!)

    I really like it as a Java IDE.
     
  9. jaykk macrumors 6502a

    Joined:
    Jan 5, 2002
    Location:
    CA
    #9
    Try Build->clean all targets ..then try again..

    or Start a new project with a different name

    I never had any problem with my PB from day one. I dont use PB much. What version of PB u have? mine is Ver 2.1 ( Dev 2002 Developer tools)
     
  10. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #10
    Eclipse kicks arse, but it requires a really really fast Mac. My dual 867 lags a bit on 3.0M3.
     
  11. King Cobra macrumors 603

    Joined:
    Mar 2, 2002
    #11
    I second JGrasp for Mac OS X.

    Simple and not processor heavy. 1.7MB.

    Take 15 minutes to get used to the interface.
     
  12. zarac macrumors newbie

    Joined:
    Oct 3, 2003
    #12
    Basic Java stuff in Project Builder

    I recently had a similar experience as a Mac island in a sea of PCs and professors who had never touched a Mac.

    I successfully built Java Tools in Project Builder and they ran on the PCs with no problem. I tried several other IDEs and even BBedit using the command line to compile and run, but I want my Mac to work like a Mac. The Java Tool project is quite simple; I stayed in Development mode and emailed my .java and .class files from the build folder.

    Many of the PC students had a much rougher time than I did and my programs were consistently more robust and creative because using the Mac was easier. By the end of the class, the Professor was much more interested in the Mac.
     
  13. mickeyd4mac macrumors newbie

    Joined:
    Oct 3, 2003
    #13
    I use JEdit. It works well on OS X 10.2.8 and is almost exactly the same program that runs on the PC but it is made for Mac OS X. You can compile right from within JEdit by installing a plugin. Its free to download and if you just do a google for Jedit it pops up where to download it. I run my classes from the command line. You can run programs that don't need input from within Jedit as well.
    Good luck.
     

Share This Page