PDA

View Full Version : Java Programming Virgen: I need help!




bobber205
Nov 15, 2005, 05:44 PM
I have used REALbasic for almost two years, so learning Java, although hard, shouldn't be to difficult.

I figure if I'm going to major in computer software and hardware engineering in college, I should at least get a head start in Java. ;)

Now here's my question. I got "Ground Up Java" off ebay. Great book. Easy to read.
But the instructions in it for setting up Java on my mini Mac aren't applying.

What should I do?
I can type in Terminal
"java -version"
and a bunch of data comes up.

So I know it's there.
What should I do? BTW I am planning on using Eclipse or Xcode, and I have installed the developer tools (that's why I have Xcode ;) )

Thanks.



jsw
Nov 15, 2005, 05:58 PM
Java 1.4.2 is pre-installed with Tiger, and Java 5.0 is available if you sign up as an ADC (http://developer.apple.com/) member (free).

Download Eclipse (http://eclipse.org/downloads/index.php) (or use Xcode, but I find Eclipse to be easier for pure Java development) and you're good to go, or simply run everything from the command line in Terminal.

jefhatfield
Nov 15, 2005, 06:01 PM
I have used REALbasic for almost two years, so learning Java, although hard, shouldn't be to difficult.

Thanks.

don't underestimate java...it's a very deep language and is unlike any other language out there...but you're on the right track if you want to be a software engineer and learn java

for hardware engineering, that's a completely different field but you may take an electrical engineering class and some higher math if you are software side, and take lots of the above if you are hardware side with some programming, and i hope your school let's you take java if you want to use it for credit towards a computer or electronic/electrical engineering degree

bobber205
Nov 15, 2005, 06:26 PM
My school I will be going to, Oregon Institute of Technology, has a special program for people wishing to do the dual-major.

In Xcode, how can I run the sample programs that came on a CD with my book?

Here are the files (http://www.alexwait.com/Personal/AnimatedIllustrations.zip)

Feel free to download them to see what I'm talking about. I want to be able to participate in the "example discussions" that are in my book.

Thanks! and keep the replies coming!

plinden
Nov 15, 2005, 06:28 PM
I have used REALbasic for almost two years, so learning Java, although hard, shouldn't be to difficult.

I figure if I'm going to major in computer software and hardware engineering in college, I should at least get a head start in Java. ;)

Now here's my question. I got "Ground Up Java" off ebay. Great book. Easy to read.
But the instructions in it for setting up Java on my mini Mac aren't applying.

What should I do?
I can type in Terminal
"java -version"
and a bunch of data comes up.

So I know it's there.
What should I do? BTW I am planning on using Eclipse or Xcode, and I have installed the developer tools (that's why I have Xcode ;) )

Thanks.
Try using the command line first - first thing, write the simplest HelloWorld.java program. The file name must match the name of the class:

public class HelloWorld {
static public void main(String[] args) {
System.out.println("Hello World!");
}
}


Compile using javac:
javac HelloWorld.java

If all goes well, you'll have HelloWorld.class in your directory.

Run using java:
java -cp . HelloWorld

Also, see what happens if you leave out "-cp ." - java won't find HelloWorld.class.

IDEs like Eclipse take a lot of the work out of your hands, but I really don't recommend using them until you're comfortable with compiling with the command line. You'll make many more mistakes that way, and will learn a lot from them.

To see the options available for java and javac, type:
java -help
javac -help

bobber205
Nov 15, 2005, 06:30 PM
BTW If I download Eclipse on my mini Mac 10.4.3 computer, do I need to download all the extra files (like the JDT and stuff like that):D

bobber205
Nov 15, 2005, 06:33 PM
This sound really bad, but I guess learning is learning...

Where do I put and save that code?
In my book there was a part that had me set up the "path", but I could never do that correctly.

I have a folder on my Desktop called Java Programming and that's where I want all my files to go. At least I think so.

jefhatfield
Nov 15, 2005, 06:54 PM
My school I will be going to, Oregon Institute of Technology, has a special program for people wishing to do the dual-major.

In Xcode, how can I run the sample programs that came on a CD with my book?

Here are the files (http://www.alexwait.com/Personal/AnimatedIllustrations.zip)

Feel free to download them to see what I'm talking about. I want to be able to participate in the "example discussions" that are in my book.

Thanks! and keep the replies coming!

i had a programming teacher, phd university of oregon in cs in programming languages, but he mainly teaches computer hardware repair (comptia a+ path) at the college, but he had to teach himself that from scratch...he also teaches java and vb, but hardware is his main gig...he's a very unusual person, right and left brained equally, and it makes him understand hardware and engineering, and coding/programming without missing a step

most programmers just don't get "real" engineering and higher math and vice versa...many a creative writer and artist make better programmers most of the time

bobber205
Nov 15, 2005, 07:54 PM
How do I set up the path for my Java programs.
I need to be able to do that before I can compile don't I?

jsw
Nov 15, 2005, 08:01 PM
Here are the files (http://www.alexwait.com/Personal/AnimatedIllustrations.zip)
Unless I've missed something, it would seem like that file contains no Java source code, merely compiled class files. Did Safari stick the *.java files somewhere I missed?

jsw
Nov 15, 2005, 08:02 PM
How do I set up the path for my Java programs.
I need to be able to do that before I can compile don't I?
All the Java executables (javac, java, etc.) are already in your path, so they should work just fine if you just, say, use Terminal to go to your source directory.

Or use Eclipse, which works well.

Or Xcode, which i haven't been too successful using Java with so far...

bobber205
Nov 15, 2005, 08:23 PM
Where do I save the text file with the code in it? the .java file/.

I am EXTREMELY confused. A detailed explanation would be greatly appreciated. I will have to wait awhile, (maybe tomorrow), for Eclipse.

IT's 100 megs to download... And I have dialup. That's 12 hours or so.

If someone could explain me how to get properly started, I would be forever grateful.

portent
Nov 15, 2005, 08:25 PM
This little app is a nice way to start off in Java...much simpler than the command line, or even Eclipse. It's basically an editor with a simple front-end for javac and the JVM.

http://homepage.mac.com/jmacmullin/

It's not very powerful, but its easy (and free.)

bobber205
Nov 15, 2005, 08:33 PM
I"ll use JJEdit until I get Eclipse.

Thanks so much! BTW Does anybody here use Eclipse for Java for when I need help?

jsw
Nov 15, 2005, 08:35 PM
Have you gone through plinden's post? It's pretty step-by-step.

jsw
Nov 15, 2005, 08:38 PM
I"ll use JJEdit until I get Eclipse.

Thanks so much! BTW Does anybody here use Eclipse for Java for when I need help?
I do. Sorry, been a bit busy tonight. I'll try to be of more help later on! Feel free to PM me with any questions.

jsw
Nov 15, 2005, 08:40 PM
BTW If I download Eclipse on my mini Mac 10.4.3 computer, do I need to download all the extra files (like the JDT and stuff like that):D
Nope - everything should be all set already under Tiger. BTW, Java 5.0 (aka 1.5) was released via Software Update today... I highly recommend getting it, as 5.0 has some fantastic new features, and you can still use previous Java techniques as well.

bobber205
Nov 16, 2005, 07:09 PM
Just thought you guys might want to know!

I just wrote from scratch my first Java program! YEAH! YEAH!

The only thing I don't like is each little app costs 6.9 megs of space to build... ???:eek:

plinden
Nov 16, 2005, 07:18 PM
Just thought you guys might want to know!

I just wrote from scratch my first Java program! YEAH! YEAH!

The only thing I don't like is each little app costs 6.9 megs of space to build... ???:eek:

Sorry, haven't been keeping up with this, but WTF? You sure? What program did you compile, using what? HelloWorld.class is 426 bytes on my PC and on my Solaris workstation.

Can you give us the exact steps one-by-one that you did?

Even the mail web application I'm working on is only 8 MBytes when compiled.

bobber205
Nov 16, 2005, 07:39 PM
I should have given more information.

I am using XCode right now, and those files include a bunch of "build" files and stuff like that.

plinden
Nov 16, 2005, 07:51 PM
Well, ok, but that's the reason I don't like IDEs - you get a bunch of stuff you know nothing about. If you're serious about Java, you'll have to learn how to set up your build environment yourself.

Anyway, when you do a release build and hand your programs off to be used, all the build stuff is not (or should not be) included.

bobber205
Nov 16, 2005, 08:00 PM
I'm noticing tons of stuff I have no idea what it is.

If I want to setup the build environment myself, can you point me to a site that explains how to do that from the ground up?

bobber205
Nov 17, 2005, 05:14 PM
http://www.bluej.org

Great java tool I found.

Just thought you might like to know. :D