Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Java:Tutorial Setting up Java and What is an IDE?

IDE Setup Net-beans

  • Please log in to reply
1 reply to this topic

#1 madushan1000

madushan1000

    CC Lurker

  • New Member
  • Pip
  • 4 posts
  • Location:Sri Lanka
  • Programming Language:Java, Python
  • Learning:Java, C#, PHP, Python, JavaScript, NXT-G

Posted 26 August 2012 - 11:47 PM

Hello :)

In my last tutorial(http://forum.codecal...-hello-to-java/),We talked about how to create a "Hello World" application as a worm up.But if you are a complete newbie to java this might confuse you.So I'm going to give a short introduction about setting up Java and an IDE.

Let's start,

Install Java

There are two versions of java that you can set up on your computer,
1)JRE (http://www.java.com/en/download/)
2)JDK (http://www.oracle.co...vase/downloads/)

JRE is the run time environment for Java application.That means JRE is only could be used to run a compiled Java .class file or .jar file.This cannot be usable to compile java applications!

JDK means Java Development Kit.This is the version developers should use.JDK enables us to develop,compile,package,etc,etc... Java applications.

So now we want to get JDK.Go to the above link,select your prefered JDK version (may be Java SE 7U6) ,
Then under "Java SE Development Kit 7u6" (or under something similar to this) select the version compatible with your operating system(For me it's Windows x86 : jdk-7u6-windows-i586.exe).You must accept the license agreement before downloading!.This download will be around 90MBs for Windows x86.

After download completes run the setup file jdk-7u6-windows-i586.exe.You will be asked to gain admin privileges for the setup if you are using UAC on Windows 7 and vista,Click Yes.Then you will be asked to Install JDK.Keep clicking next :D

java_install_over.PNG

On this click continue and you are done installing Java!

But we still have few little things to do,

Open a command window (Windows key + R and type cmd),
type
java

This will output something like this
Usage: java [-options] class [args...]
		 (to execute a class)
or java [-options] -jar jarfile [args...]
		 (to execute a jar file)
.................
...................
................................

If not,There is something wrong with your Java installation.Try re-install.

Then,
type
javac

This will probably output,

'javac' is not recognized as an internal or external command,
operable program or batch file.

If not you good to go.

But if this happens,you have to set up the PATH environment variable,
To do this right-click on "Computer" icon ("My computer on XP"),Click "Advanced System settings".
In the next window select "Advanced" tab and click the "Environment Variables..." button.

Next window,Under "System variables".Select "Path" and click "edit..."
Add a semicolon ";" at the end of the line and past your jdk/bin folder path (For me C:\Program Files\Java\jdk1.7.0_04\bin).

env_v.PNG

Click "Ok" on all three windows and log out and log in.
Open a command window,
type

java

and

javac

This time It will give proper outputs.If not check everything again.

Install an IDE

IDE means "Integrated Development Environment".An IDE is a software that makes programming easy.It has a integrated code editor giving ability of fast coding and etc..

For Java there are quite a lot of IDEs available,
Search Google for "Java IDE" and you will find out some.

The most popular ones are Eclipse(http://www.eclipse.org),NetBeans(www.netbeans.org) and Jbuilder.

I'm going to tell how to set up and use NetBeans.

Go to the NetBeans page and click the "Download x.x" on the top of the page.
In the next page select "Java SE",The download will start.
After download completes run the setup and install like any other software.Give the JDK path if asked.

Open NetBeans from desktop shortcut or Start menu.Program may load for few minutes.(Of cause it's a huge software :D)
After loaded

netb.PNG

Click
File>New Project

Select "Java" from the Left side box and select "Java Application"
Click "Next",
Then Give a project a name and a project path.
Click "Finish".

netb2.PNG

This is your code window.Try some code and Click Run>Run Main Project to test your code.

Here is a simple Hello World NetBeans project,Download it and test out.Just go to File>Open and select the extracted project folder.

Attached File  Hello World.zip   358.12KB   319 downloads

That's It.

Any questions or comments are welcome.See you In next tutorial.
  • 0

#2 maher

maher

    CC Newcomer

  • Member
  • PipPip
  • 15 posts
  • Location:India
  • Programming Language:C, C++, (Visual) Basic
  • Learning:Java, PHP, JavaScript

Posted 06 October 2012 - 02:21 AM

that was helpful. Thanks. Keep up the good work :thumbup1:
  • 0





Also tagged with one or more of these keywords: IDE, Setup, Net-beans

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download