Please do it in the privacy of your own home …

idiotdiscΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 4 χρόνια και 11 μήνες)

225 εμφανίσεις

Please do it in the privacy of your own home …


To download Java and Netbeans for free to use at home, go to:


http://www.oracle.com/technetwork/java/javase/downloads/index.html

Scroll down about half the page and select this download.




Click on the DO
WNLOAD button and
look for the following on the next page
.




Follow

the instructions on the screen


accept all defaults during installation.




Once it is installed, you should be able to create a new project in NetBeans by going to Start


Programs


NetBeans.


For the Geek in You (or in Someone You Live With):

Once you have Java and NetBeans installed, you can
also
use the old fashion way of creating programs using
Notepad and DOS.

Do know that one can live a full and successful life without ever

using anything but
NetBeans (until something better comes along).
Before you can easily do this, a path setting should be made
for Java. This is a one
-
time configuration.


From: http://java.sun.com/javase/6/webnotes/install/jdk/install
-
windows.html


(
We are

using version 17 in this class, but the version you use here will be much newer.)


How do I set the PATH permanently?


To set the PATH permanently, add the full path of the
jdk1.6.0_<version>
\
bin

directory to the PATH variable. Typically this full
path looks something like
C:
\
Program Files
\
Java
\
jdk1.6.0_<version>
\
bin
. Set the PATH as follows on Microsoft Windows:

a.

Click
Start > Control Panel > System

on Windows XP or
Start > Settings > Control Panel > System

on Windows 2000.

b.

Click
Advanced > Environ
ment Variables
.

c.

Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for
PATH is:

C:
\
Program Files
\
Java
\
jdk1.6.0_<version>
\
bin


PATH environment variable is a series of directories separated b
y semi
-
colons (;) and is not case sensitive. Microsoft
Windows looks for programs in the PATH directories in order, from left to right.


You should only have one
bin

directory for a JDK in the path at a time. Those following the first instance are ignored.

If one
is already present, update it to jdk1.6.0_<version>
\
bin.


If you are not sure where to add the path, add it to the right end of the PATH in the User Variables.


The new path takes effect in each new command window you open after setting the PATH va
riable.

Once the path is set, open the DOS prompt by going to Start


Run


in the Run window, type:
cmd

You should now be brought to the DOS prompt.

To change to the C:
\

drive, type
C:
<enter>

Create a new folder on C called javatest by typing this:
mk
dir javatest

<enter>

To
see if the folder was created, type:
dir <enter>

This should show you all the files and folders in C.

To move to the new javatest folder, type:
cd javatest

<enter>




(cd stands for change directory)

To create a new java file, type:
Notepad <enter>


Enter in a simple program:


public class Hello {


public static void main (String[] args) {


System.out.print ("Goodbye, ");



System.out.println ("cruel world!");


}


}


Save the file with the name Hello.java into your javatest folder.

You then first have to compile the file. Type:
javac Hello.java

This creates a new file called
Hello.class
. This is the file to

run with Java. Type:
java Hello