What is the best way to start creating java programs?

I compiled and then pressed the run button.

It did say "to run this application from the command line without ant, try:". Does this ant have something to do with it not running?
 
Last edited:
just before the "Build Successful" message should be

run:
Hello World

Netbeans prints the output of the program before the final message (in the Output window)

If you dont see this then chance are youve not set the Main Project

To set a project as the main project, right-click the project node in the Projects window, and choose Set as Main Project. Only one project can be the main project at any time.

Then From the IDE's menu bar, choose Run > Run Main Project.
 
Last edited:
Ant is a tool used for automated building from xml files, bit like a make files in c/c++. You shouldn't be needing to generate Ant builds... there should be just be a normal compile and run option.
 
Wrox and O'Reilly books are generally very good for programming. However these can cost around 20 quid or more. There are lots of resources online so just look for beginners guides.

Next step of course is finding a good IDE and to be honest many of them are not great for first time users as they can be an arse to set up.

With the above in mind I recommend BlueJ and it associated book: http://www.bluej.org/

I used this in uni and it is brilliant for someone who is learning. Once you are more comfortable you can go ahead and use a different IDE.
 
manic_man said:
I can echo the fact that learnign OO would be a very good first step.

You have used C++ in the past so have a good inkling of the basics of classes etc but C++ is (arguably) not truly OO. It was a concept "tacked" onto C++ when it became popular.

Java on the otherhand is entirely OO. I would suggest you master the concepts of packages, inheritance etc before you get to stuck into coding.

I made the mistake of not doing this, it meant that about 3 years in, although I could code, I was still learning the basics as and when I needed to know them ,as a result of this I was doing some vey silly things in my programs which could have been avoided or certainly done in a better way had my grasp on the fundamentals of OO been superior.

It really wont take too long. I also find using UML class diagrams is a very useful way of planning out a java app before I really get stuck in. Ok its not usually possible to draw up something 100% accurate before you have started but even just having an outline of the apps class structure can be very useful.

EDIT: Also i think this IDE vs command line stuff is a bit moot, come on the guy can program in C++ and is moving onto Java, ok he had a few teethign troubles but after a week or so messing round in an IDE, typing in "javac xxx" isnt going to really tax him(/her) too much. Personally I dont think it matters if people start in an IDE or not, its the coding itself that is important.

Oh, also, from the very start.... make use of the try/catch error handling structure, its one of Java's true strengths an again, my poor initial knowledge led me to not make use of it for far too long....

dont try to run before you can walk :/
 
Clarkey said:
dont try to run before you can walk :/

I agree. It is far better to make the mistakes and learn from them. Trying to learn about inheritence and so on before he has typed in a single brace is futile.

It would be like teaching a pilot to do a loop before he or she can get the plane off the ground.
 
Back
Top Bottom