Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes What do I need to run my first simple program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What do I need to run my first simple program?" Watch "What do I need to run my first simple program?" New topic
Author

What do I need to run my first simple program?

Brian Cee
Greenhorn

Joined: Feb 06, 2008
Posts: 2
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

Joined: Oct 13, 2005
Posts: 40061
    
  28
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

Joined: Aug 31, 2004
Posts: 11343

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.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
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).


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40061
    
  28
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

Joined: Nov 08, 2007
Posts: 457
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

Joined: Feb 06, 2008
Posts: 2
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What do I need to run my first simple program?