Thought and Freedom

Articles for those who think. By Terry Pearson

Archive for the ‘Java’ Category

Java to become open source

without comments

Introduction to Java Programming-Comprehensive Version (6th Edition)Sun Microsystems announced on October 25th that they are on the fast track to making Java an open source product.

Sun has been on an open source soapbox since their new CEO, Jonathan Schwartz, took over the company.

Open source software has paved the way for rapid development of great software throughout the world. Projects such as Mozilla’s Firefox, or OpenOffice.org have been shining examples of success in the open source movement.

Making a language opensource is a completely revolutionary idea. It should be interesting to see how Java can maintain stability and long term effectiveness with a less centralized development team.

This could develop into a perfect language, a bloated language, or somewhere in between. My hope is for perfect! We will just have to wait and see what comes of it.

Written by Terry Pearson

November 3rd, 2006 at 8:32 pm

Posted in Business,Java

Installing a Java Compiler

without comments

So you have a great looking program. Perhaps you typed out the source code for the hello world tutorial. Now, you need to transfer that source code into a computer language. You do that through a process called compiling. In our case, Java is compiled into Java Bytecode.

Sams Teach Yourself Java 2 in 21 Days (4th Edition) (Sams Teach Yourself)

Compiling a Java file produces a new file. If the old file is called HelloWorld.java, the compiled version of the file will be HelloWorld.class. This is how you can tell the difference between a compiled class and the original human readable format.

Where do I get a compiler?

Fortunately for potential Java programmers, the Java compiler (called the Java SDK) is free. The most generic solution is to go to the Sun Microsystems Java 2 SE download page and get the latest compiler version.

However, there are other options. One thing that I would recommend is to install an Integrated Development Environment, such as Netbeans. The Netbeans installer can also install the Java SDK. You will find a link to the Netbeans installer on the same Java SE download page. There is also a special “learning edition” of Netbeans that is called the BlueJ edition. It can be found here. It is specially designed to help students of java to learn the basics, and get familiar with an integrated development environment.

Written by Terry Pearson

September 26th, 2006 at 5:36 pm

Posted in Java,Tutorials

Java: Hello World

with one comment

Java is becoming an important language for every programmer to know. It is key to creating platform independent software. In my opinion, Java will continue to play a greater role in enterprise software development.

Those who are computer science majors will recognize the “Hello World” application as the traditional “first application” that a programmer learns. Every time you learn a new language, the books almost always start with hello world!

I will start with the code, then explain:

Java Hello World

This would all be contained in a file called “HelloWorld.java”


public class HelloWorld{

This line defines the name of the program (HelloWorld). If you think of a class as a mini program, than this line is the name of the program. It also tells us that the type of class it is (public).

Note: The open curly bracket, “{” also has a closing curly bracket to match it. The closing curly bracket is found at the end of the class. Every time an open curly bracket is created, a closed bracket must be placed somewhere later in the file.

public static void main (String[] args){

This is a line that every java programmer can eventually recite in their sleep… Backwards and Forwards! Almost every Java program will begin with this line.

This line is actually creating something called a method. Think of a method as a task that a computer program can do. If this program were human, it might have tasks such as walk, eat, read, talk, etc. In the same way, a computer program has certain tasks it can do. Inside the curly brackets, we will tell how the method works.

This method is called “main.” The words before “main” are the descriptions as to how the method operates. The “String[] args” inside the parentheses actually serves as a way to pass a set of data to the method. You will learn more about this in future tutorials.

System.out.println(“Hello World”);
}

}

This is the meat and potatoes of the program. It’s what really makes the program have purpose. This is a very basic command, telling the computer to output “Hello World” onto the screen.

The main method only contains this one statement, but it could include several. This is just for demonstration purposes, so utility is not our goal. Each statement must end with a semicolon. Once the block of statements is complete, you close the curly brackets.

Now, you just need to compile and run your program, but I am saving that for tomorrow!

Written by Terry Pearson

September 25th, 2006 at 11:46 pm

Posted in Java


Creative Commons License
Terry Pearson - The Blog by Terry Pearson
is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.