Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jibberia

macrumors newbie
Original poster
Sep 30, 2003
29
0
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
 
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.
 
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.
 
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
 

Attachments

  • picture 7.jpg
    picture 7.jpg
    54.4 KB · Views: 477
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?
 
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.
 
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.
 
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.
 
Originally posted by jibberia
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?

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)
 
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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.