PDA

View Full Version : Another Java Question




larswik
Sep 8, 2006, 03:48 PM
Hey this is my first post. I looked through the page for an answer to Java and I think mine is more simple. Where can I find a book on learning Java on the Mac? I was at Boarders book store and they had about 50 or so books but all the images were Windows loking and I wasn't sure if that would work on the Mac.

I know some Lingo from using Director and bought a Unix book and have been learning the Terminal and unix functions.

I want to build a small simple app that will allow me to commnicate with other computers (non Mac) that I have in hotels playing back video. I can use FTP to upload to the units and the TELNET commands to control the units like play, stop, list using the Terminal app. I want to bundle those simple operations into a GUI interface and I think JAVA can do that from my research. Plus I want to learn Java.

Is there a JAVA for dumbies on Mac book that can get me started learnign JAVA?

Thanks!

-Lars



peterparker
Sep 8, 2006, 03:51 PM
Look for a good Java Swing book. No need for a Mac specific book.

larswik
Sep 8, 2006, 04:01 PM
Thanks, what is Java Swing? is it a non OS spacific way of learnign Java?

-Lars

larsf
Sep 8, 2006, 04:05 PM
You dont need any mac specifics for an application like that, check out the tutorials on this page.

http://java.sun.com/docs/books/tutorial/

larswik
Sep 8, 2006, 04:11 PM
Cool, I'll take a look at those Tut's. I kind of like having a book that I can flip through and I really want to start learning from the begining. This morning I didn't know what the differance were between JAVA and JAVA SCRIPT.

So I want to start of with the basics of programing this laungage.

It also seems like Java Swings is more of te GUI type app. is that a different version of Java or part of the same package?

-Lars

atmenterprises
Sep 8, 2006, 04:12 PM
Well, Java Swing is a windowing toolkit. It is the GUI classes, essentially. Buttons. Forms. Textboxes.

Java is a write-once, run anywhere language. You can write your code on a Mac and run the interpreter to have it execute on a PC, and vice-versa.

I don't know that a Windows Java book is going to be any different from a Mac Java book in teaching you how to program in this language. Whereas a Windows book tells you to set your ENV and HOME environment variables in a specific way, a Mac book would obviously tell you to set them differently because Unix and Windows use different commands to do the same thing.

As someone who programs in Java in Windows and OS X, I recommend you go download Netbeans - a free Java IDE - at java.sun.com under the J2SE downloads like (either 1.4.2 or 1.5 versions will do). When you install it all of your environment variables will be set up for you AND you can just write your code in the IDE and run it from the IDE - without having to drop to DOS or Terminal.

Thanks, what is Java Swing? is it a non OS spacific way of learnign Java?

-Lars

larswik
Sep 8, 2006, 04:23 PM
I must say this board is very fast with responses. I'm heading to LAX to pick up a friend. I will take another look at some books for Java. I'm not wanting to learn everything there is about the laungage but I would like to be able to build that app to use the FTP'ing and TELNET service that terminal offers.

Can Java execute Unix functions? so in Java I can have it call up those functions that I use in the terminal within Java?

Thanks again for all this fast replying. Off to LA right now.

-Lars

NewbieNerd
Sep 8, 2006, 04:35 PM
Can Java execute Unix functions? so in Java I can have it call up those functions that I use in the terminal within Java?

-Lars

Yup, very simple. I think it's

Process p = Runtime.getRuntime().exec("ls -lhF")

or whatever command you want to execute. Then you can get the output and error streams from it.

larswik
Sep 9, 2006, 02:18 AM
Cool, now that phrase that you wrote is greek to me but I will start learning Java today. I know it will take some time but i'm in no hurry. I bought JAVA for DUMMIES- 9 in 1 book that covers swing objects and others.

Is learning SWING almost the same as learning JAVA. I know it is the same type of programing laungage but from what I understand it is a different style, is that right? I am lookign to build a GUI interface to get away from the Terminal commands but was wondering if I should skip ahead to the Swing section in the book and stat to learn that or start at the begining. A post above said I should start with Swing.

Thanks, you guys are awsome!

-Lars

atmenterprises
Sep 9, 2006, 06:52 AM
Well, Swing IS Java. Sun's Java provides two toolkits to build graphical user interfaces. One is the AWT (Abstract Windowing Toolkit) and the other is Swing. There are some third-party GUI classes as well (one called SWT comes to mind).

But if you're going to learn Swing you need to learn the rest of Java. Having a firm grasp on concepts such as instantiating objects, loops, variable scope, methods, properties, public/protected/default/private class scope are all important to your success. If you already know all of that, go for it! But if you don't know Java, you're not going to be able to write and understand an app with a Swing interface until you know how to call methods and instantiate objects.

Is learning SWING almost the same as learning JAVA. I know it is the same type of programing laungage but from what I understand it is a different style, is that right? I am lookign to build a GUI interface to get away from the Terminal commands but was wondering if I should skip ahead to the Swing section in the book and stat to learn that or start at the begining. A post above said I should start with Swing.

larswik
Sep 9, 2006, 12:07 PM
That works for me. I will start with the Java basics in the front of the book. Also I will look at the info from the Sun site that someone else posted here.

Thanks again for all yor help. It's nice to find a freindly all knowing fourm : )

-Lars

x704
Sep 9, 2006, 01:05 PM
I second downloading and using NetBeans IDE.

I would also pick up a couple of good books on the subject of Java. I recommend JAVA Software Solutions Foundations of Program Design second edition by John Lewis and William Loftus ISBN 0-201-61271-2 for a decent tutorial. And for a reference I recommend Beginning Java 2 by Ivor Horton second Covers JDK 1.2 ISBN 1-861002-23-8. Both are the best books I have seen, also if you can try to get the same books only for JDK 1.4 (Java Developers Kit). The big book covers applications written in java too unlike most.

larswik
Sep 9, 2006, 04:32 PM
I'll look into those books.

-Lars

nutman
Sep 9, 2006, 04:59 PM
im taking comp sci at school and we use jcreator.. cause its free.

larswik
Sep 9, 2006, 06:33 PM
Looking at the Sun site they use xcode as the IDE in their examples. I guess there are alot of tools (IDE's) to help you program in Java. The apple site talks about Eclipes, Sun site shows xcode and I am now downloading Netbean IDE.

I'm going to try Netbean to start. thanks for all the options!

Now on to page one of the learning Java book!

-Lars

peterparker
Sep 9, 2006, 06:51 PM
Eclipse is arguably the most popular Java editor. After that, NetBeans, JBuilder, IntelliJ are some of the top Java editors.

geomes
Sep 10, 2006, 12:41 PM
I am another newbie to this forum.

Swing is not implemented using any native code. One problem with AWT is because it used the native code on each platform it was restricted to features present on every platform.

You can still use AWT but Swing is preferred.

richard4339
Sep 10, 2006, 03:40 PM
At my school, we just use Textpad. No IDEs for us! Since my migration to Mac, though, I've started using Textmate.