• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What do I need to run my first simple program?

 
Brian Cee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm trying to write and run simple code for the first time in java. What exactly do I need to install to do this? I went to java.sun.com, but there are so many downloads to choose from, I really have no idea what I need.

Any help would be appreciated and thanks in advance!

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch. Do you remember the downloads page? You want what is called JDK 6 update 4.

Download that to any old folder, install as per usual, and note carefully which folder it goes into. Then follow the instructions for setting the PATH variable. It is usually easiest to set it permanently, at least until update 5 comes out! The path name you want starts with / and ends with /bin on Linux/Unix/Mac and it usually starts with C: and ends with \bin on Windows.
If you use Unix/Linux it varies from one installation to another how you update your PATH, and a Google search will be useful for permanent updating, but writing "export PATH=/usr/bin/java/jdk1.6.0_04/bin:$PATH" (or similar) at the beginning of the session usually works.

For the very first application you will probably want a Hello World. There is one in the Java Tutorial here. Follow it closely, and note the "common problems" link.
Don't use NetBeans at this stage. Don't use Notepad, a dreadful application, but get Notepad++ or similar for Windows. (If on Linux try gedit or Kate, two excellent editors.)

That should be sufficient to get you writing "Hello Brian" on screen. Good luck.

CR

[edit]Add this link to installation instructions.[/edit]
[ February 06, 2008: Message edited by: Campbell Ritchie ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Welcome to the Ranch. Do you remember the downloads page? You want what is called JDK 6 update 4...

Unless you're using a Mac, in which case Java should already be installed and ready to go. If that's the case, let us know and we'll move this to our Mac forum.
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you familiar with Integrated Development Environments?

If so, perhaps you should check out the Eclipse IDE, available for free download.

It will provide you with a free code editor, and will manage the compiles, and you can launch the application from there (optionally in a debugger).
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that Eclipse (and NetBeans) are good products, but I agree with the notion that beginners should be kept well clear of IDEs. Learn to use the command line or shell and a text editor first.
And I quite forgot that Java is preinstalled on Macs. Thank you for the reminder.
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you CAN get very minimal if you'd like to:

launch Terminal...


I didn't alter the default paths for the cshell, so the java and javac are already there. (But, of course, Brian hasn't said if he's on a Mac or not)

That should also work on any UniX-ish system
That was fun
=)

[ February 06, 2008: Message edited by: Bill Shirley ]
[ February 06, 2008: Message edited by: Bill Shirley ]
 
Brian Cee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I apologize, I did forget to mention that I am running Windows XP.

I followed Campbell Ritchie's steps and everything worked out fine. I was able to follow the installation instructions and run the sample program.

I also want to thank everyone else that posted for taking the time to help me out. I was not expecting such fast and informative replies. I truly do appreciate it! Thank you so so much!!



Thanks,
-Brian
[ February 06, 2008: Message edited by: Brian Cee ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic