IPlay
November 22, 2009, 02:03:08 pm
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
Forever
Login with username, password and session length
News
: Welcome to iPlay! Hope you enjoy your stay!
Home
Forum
Help
Search
Staff List
Login
Register
(Tut) How to Download Java
IPlay
>
Forum
>
Programming
>
Java
>
(Tut) How to Download Java
Pages: [
1
]
« previous
next »
Print
Author
Topic: (Tut) How to Download Java (Read 243 times)
drask182
Newbie
Rep: 0
Offline
Posts: 5
(Tut) How to Download Java
«
on:
March 29, 2008, 08:39:36 pm »
Hello all! Welcome to this thread! Basically what I have done here is taken the most helpful topics I can find, add loads of information, and prepare a guide for beginners who wish to make servers, learn Java, learn to edit thier server, etc. Some of my own work has been put into this, credits will be given as nessecary.
Firstly, we will start off the table of contents. Please be aware that this topic will be several pages long, so I will do my best to anchor them to the best of my ability.
>->->----------><----------<-<-<
Table of Contents
Chapter #1 – Java Development Kit(JDK)
Part #1 - Getting JDK
Part #2 - Getting JDK recognized
Chapter #2 – Learning Java
Part #1 - Java Basics - A beginner's Tutorial
Part #2 - Basic Java Programming Conventions
Chapter #3 - Server Joining
Part #1 - Joining a Hamachi Server
Part #2 - Joining a Private Server
Chapter #4 - Making a server
Part #1 - Making a Hamachi Server
Part #2 - Making a Private Server
Chapter #5 - Learning to edit your server
Part #1 - Making Global Objects
Part #2 - Changing Character Rights
>->->----------><----------<-<-<
I hope you enjoy the thread, please leave feedback.
Chapter #1 - Java Development Kit(JDK)
Part #1 - Getting JDK
Alright, lets start by getting the latest version of Java. This will allow you to run the 'perfect' compiler v 1.9 by Mod Taharok. First, open up your internet browser and type "
www.google.ca
" into the "address" box.
In the search box, you must type in "Download JDK 6u2". Now hit "Enter" on your keyboard or click "Search".
Now, select the third link, it will look something like this.
You will be taken to a page in which you will see several different download selections. Select the one in the picture below.
Now, you
must
accept the license agreement, otherwise, you will not be able to download JDK.
Select to download the "Offline Installation, Multi-language". Remember to select the correct installation for your computer (Windows, Linux, Solaris SPEC, Solaris x86, Linux x64, Windows x64). To find out which version to download, open "My Computer" and then click "View system information". Now you must read to find out.
If you are not sure, be sure to ask a parent/adult.
Select "Save File" and you a window will open with the title "Downloads". In this screen, you will see the progress of your downloads. When it is complete, select "Remove" which is on the Right-hand side of the window. Now you may close the downloads window by clicking the "
" in the Top-Right-hand corner of the window. A picture of the downloads window is in the picture below.
You have successfully downloaded JDK!
Top
•
Bottom
•
Contents
Part #2 - Getting JDK Recognized
Now that you have the latest version of JDK(6u2) you need to declare it's existence in your computer. What you are doing is telling your computer that Java is there. This can be done by following the steps below.
Open up "My Computer".
Click "View System information"
Click "Advanced".
Click "Environment Variables".
Under "User Variables" click "New".
Name it "CLASSPATH" and for the "Variable Value" (
only if you have JDK 6u1
) put this in:
CLASSPATH=C:\Program Files\Java\jdk1.6.0_01\bin;%CLASSPATH%;
If you have JDK 6u2, you must enter
CLASSPATH=C:\Program Files\Java\jdk1.6.0_02\bin;%CLASSPATH%;
for the variable value. If you have JDK 6u3, you must enter
CLASSPATH=C:\Program Files\Java\jdk1.6.0_03\bin;%CLASSPATH%;
for the variable value. If you have JDK 6u4, you must enter
CLASSPATH=C:\Program Files\Java\jdk1.6.0_04\bin;%CLASSPATH%;
for the variable value.
Under "User Variables" click "New".
Name it "PATH" and for the "Variable Value" (
only if you have JDK 6u1
) put this in:
C:\Program Files\Java\jdk1.6.0_01\bin
If you have JDK 6u2, you must enter
C:\Program Files\Java\jdk1.6.0_02\bin
for the variable value. If you have JDK 6u3, you must enter
C:\Program Files\Java\jdk1.6.0_03\bin
for the variable value. If you have JDK 6u4, you must enter
C:\Program Files\Java\jdk1.6.0_04\bin
for the variable value.
Click "OK".
Click "OK".
Your computer now recognizes Java.
Top
•
Bottom
•
Contents
Chapter #2 - Learning Java
Part #1 - Java Basics - A beginner's Tutorial
Hi guys. I've decided to do yet another topic on Java fundamentals, despite the fact that most of you are too lazy to get up off your arses to read it.
First things first: variables. Java has several fundamental variable types, known as 'primitives'.
These variable types include:
boolean
char
byte
short
int
long
float
double
Each of these primitives can store data. More information on primitive data types can be found here:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html
I suggest you read the information found on this page before continuing with this tutorial. If you are too lazy to do that then you are probably best off leaving the forums - we don't want you here.
Now that you know how to store data, you're probably wanting to work with it. This is when operators become useful; they allow you to do all sorts of things with variables: you can compare variable, you can increment them, decrement them, and so on. I will omit unary operators, for the sake of keeping this tutorial simple for newcomers.
The basic operators are as follows:
Equality operators: != and ==
Increment operator: ++
Decrement operator: --
Multiplication operator: *
Division operator: /
Addition operator: +
Subtraction operator: -
Logical AND operator: &&
Logical OR operator: ||
Relational LESS THAN: <
Relational GREATER THAN: >
Relational LESS THAN OR EQUAL TO: <=
Relational GREATER THAN OR EQUAL TO: >=
Assignment operators: +=, -=, *=, /=
The aforementioned operators allow you to change the value of a variable. Let's take a look at how these work.
Presume x has a value of 5 to begin with in each of the examples below:
Examples
New x value
x++;
x equals 6
x--;
x equals 4
x += 5;
x equals 10
x -= 5;
x equals 0
x *= 5;
x equals 25
x /= 5;
x equals 1
Now that we have learned to assign new values to a variable, we can learn how to compare variables to other variables.
Let's look at some boolean expressions based on comparing two ints, x and y.
For this example x will have a value of 5, and y will have a value of 10:
Examples
Returned value
x < y;
Returns TRUE
x > y;
Returns FALSE
y <= x;
Returns FALSE
x >= y;
Returns FALSE
x == y;
Returns FALSE
x != y;
Returns TRUE
x == 5;
Returns TRUE
x != 5;
Returns FALSE
It is important for you to understand this table so that you can pick up on conditionals later on in the tutorials.
Now that primitives and operators are out of the way, we can make a start on 'methods'. A 'method' is a block of code that has an identifier (an 'identifier' is a name); this block of code carries out various statements, which are situated inside of the method's opening { and closing }.
Methods have various return types. The standard return types are the primitive data types (boolean, char, byte, short, int, long, float, double), along with the return type 'void'.
The 'void' return type is the only type of method that does not require a 'return' statement, however including one is permitted.
Upon hitting a return statement, the method will return the variable it is told to return, and control flow will return to the location where the method was called.
Let's take a look at some examples. Firstly, we'll look at how a simple method can return an integer value:
[/list][/list][/list][/list][/list]
Code:
public int getAge() {
int age = 20;
return age;
}
As you can see, this method assigns the value 20 to the int 'age', and then returns the int 'age'.
To call this method, one simply has the statement
Code:
getAge();
somewhere in another one of their methods.
Now let's take a look at a more complex method: This method will take two int arguments (an argument is simple a parameter passed on to a method) and return the product of them.
Code:
public int getProduct(int a, int b) {
return a * b;
}
As you can see, I have jumped straight to a return statement: it is a good to do this when possible, as it will keep your methods small and neat. So what is this method doing? As you can see, we have used the * operator listed above - this operator multiplies the variable a by the variable b.
You're probably asking how we call such a method. It really is quite simple. You can do it with a statement like this:
Code:
getProduct(5, 10);
Alternatively, you can use variables instead of literal values, like so:
Code:
int a = 2;
b = 5;
getProduct(a, b);
You may have noticed that so far, I'm calling the method and it's returning a value, but I'm not doing anything with the value: doing such a thing in a real program is a waste in many cases. However, you can use a method to assign a value to a variable.
Going further with the example above, we could do this:
Code:
int a = 2;
b = 5;
int c = getProduct(a, b);
In this case, the variable 'c' would be equal to 10, as getProduct returns the value of (a * b), or (2 * 5).
Control flow is used to make your program do various things based on a condition or conditions. The simplest form of control flow is the if statement.
The syntax for an if statement is simple:
Code:
if (condition) {
doSomething();
}
The code inside this if statement will only be executed if condition evaluates to true. It is important to realise that all control flow structures are based on boolean values: a simple true or false. For example, in the above example, condition is either true or false.
'Condition' in the above example could be many things. For example:
Code:
if (5 == 4) {
System.out.println("What has happened to the world???");
}
In this case, the condition inside of the if statement (5 == 4) will ALWAYS return false, and the statement within this if statement will never be called.
An if statement can also obviously have a condition based on a variable. For example:
Code:
int a = 5;
int b = 2;
if (a < b) {
doSomething();
}
In this case, a happens to be greater then b, and the program will never enter into this if statement. However, if a had a value of 1 or lower, then the program would indeed enter this if statement, and carry out the statements inside.
But wait, there's even more that can be done with an if statement. You can optionally add an 'else' block, which will ONLY be carried out if the condition inside the if clause returns false.
An example of this:
Code:
if (5 != 5) {
System.out.println("What a world eh?");
} else {
System.out.println("Thank god 5 equals 5!");
}
5 is obviously equal to 5, so that condition returns false. That being the case, the contents in the else block are carried out (in this case, the message "Thank god 5 equals 5" is printed to the screen).
I'll add more to this tutorial at a later stage. For more information, visit
http://java.sun.com/docs/books/tutorial/index.html
and read the tutorials there.
100% Credits to Lothy for this.
Top
•
Bottom
•
Contents
Part #2 - Basic Java Programming Conventions
I posted this ages ago, and it was moved to the Java section on the other boards. However, I think it will provide excellent information for those of you who want to write your own code. It's really basic, and really only pertains to variables and methods. I didn't bother with packages in the old version, and I don't see a need to now (most of you won't know what a package is). Nevertheless, it will provide an excellent introduction to proper naming of fields, methods, classes, and the like.
In the programming community, it is *expected* that you follow the conventions. People are less inclined to help you if you fail to do so, your code is less readable in most cases (especially if you fail to indent it), and in some cases people won't read your stuff period.
The instructions below will show you how to *properly* name variables, methods, classes and so on.
Naming Methods:
In the case of this forum, many of you identify a method as either a public void, public boolean and public ints. In the case of booleans and ints, they're 'methods' when they take parameters (Stuff between the () that appears at the end of the method name), or when they carry out something *before* returning a value, or when they simply carry a return statement, which will return a value dependant on that method's type.
Naming methods is simple: Just start them with a lower case letter, and for every consecutive word (any word after the first word in the name) start it with a *capital* letter.
So the first word starts with a *lowercase or little* letter, and any following words start with a *uppercase or big* letter. Do not separate the words with underscores.
An example: simpleMethodName - As you can see, simple starts with a lowercase s, and the following words method and name start with uppercase characters.
Naming Variables:
Variables are named in the same manner as methods - The first word in the variable's name starts with a lowercase letter, and all following words start with a capital letter.
Naming Contants:
Constants are something seldom seen here on the forums, but I'll demonstrate how they should be named anyway; you never know when you might find them useful. (Constants could be used as level requirements and the like).
Constants look like this:
Code:
public final int CONSTANT_NAME
The keyword that identifies a constant is 'final'. Constants are 'final' because no part of your program can change their value while the program is running - Should any of your code try to change a constant, a compile time error will occur whilst compiling.
As you can see above, the name of the final int is CONSTANT_NAME - That's an example of how you name contants, or 'final' variables.
You capitalise *all* letters, and separate words with an underscore - It really is that simple. :eek:
Naming Classes:
Classes should have all words start with a capital letter.
An example of this:
Code:
public class NewClassName
The name of the class in that example is 'NewClassName'. As you can see, all words begin with a capital letter, and there are no spaces or underscores.
If a class is prefixed with the 'public' modifier, it must have its own file. So say I actually made the class NewClassName - It would have to go in its own file called NewClassName.java.
More then one class can go in each Java file, but only one of those classes can be a 'public' class, and the file name must *always* be named identically to that class. If you don't make the filename the same as the public class' name inside, a compile time error will occur.
Indentation:
Indentation is another one of those *things* that can make or break your code when you want to share it with others. You might not mind that the code is hard to read, and looks like shit. However, if you want to post it as a tutorial, I suggest you indent it so others can read and follow what's happening easily.
An example of indentation:
Code:
public class Hi {
public static void main(String[] args) {
System.out.println("This is indented code");
}
}
As you can see, I've moved my lines of code inwards - This basically makes it easy to see that the method 'main' is a part of the class 'Hi'. It also makes it easy to see that the line being printed is being printed by the main method.
Try 4 space indentation - 4 spaces is half the size of a tab in notepad.
100% credits to Lothy for this.
Top
•
Bottom
•
Contents
____________________________________________________________________________________________
Report Spam
Logged
IPlay
Founder
Newbie
Rep: 5
Offline
Posts: 22
Re: (Tut) How to Download Java
«
Reply #1
on:
March 29, 2008, 09:29:46 pm »
Nice Lol
Report Spam
Logged
Max
Founder
Newbie
Rep: 0
Offline
Gender:
Posts: 9
Re: (Tut) How to Download Java
«
Reply #2
on:
March 30, 2008, 02:52:32 am »
My guess is:
You copied that from somewhere
Report Spam
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Sig Of The Week
=> Tutorials
=> News
=> General Discussion
=> Suggestions
=> Spam
=> Rules
=> Introduce Yourself
-----------------------------
Programming
-----------------------------
=> PHP
=>
HTML
=> Visual Basic
=> Java
-----------------------------
MMORPGS
-----------------------------
=> World Of Warcraft
===> Blackmarket
=> Runescape
===> Blackmarket
-----------------------------
Graphics
-----------------------------
=> Tutorials
-----------------------------
Consoles
-----------------------------
=> Pc Gaming
=> Gameboy Advanced
=> Nintendo Wii/Nintendo DS
=> PS2/PS3
=> Xbox/Xbox360