Java 7 Released!

Oracle release Java 7 Standard Edition in 2011 July 28! This is a big news for programmers.

“We are excited to announce Java 7 is released!

With years of hard work from our dedicated engineers, the largest team ever to work on the Java language and platform, as well as valuable input from the Java community, we are moving Java forward with this release.

This release contains new language features (JSR 334), support for dynamic languages (JSR 292), a new multicore-ready API (JSR 166), new I/O APIs (JSR 203), and many other new features.”

java7logo

(from Oracle official site)

Java 7 SE downloading link: Java 7 downloads

The Java 6 was released in 2006 Dec 11, there have been almost 5 years passed. The time is long, but the next version Java 8 expected to be released on late of 2012.

Java programmers must check the important technology changes in Java 7:

Highlights of Technology Changes in Java SE 7

Swing
IO and New IO
Networking
Security
Concurrency Utilities
Rich Internet Applications (RIA)/Deployment
Requesting and Customizing Applet Decoration in Dragg able Applets
Embedding JNLP File in Applet Tag
Deploying without Codebase
Handling Applet Initialization Status with Event Handlers
Java 2D
Java XML – JAXP, JAXB, and JAX-WS
Internationalization
java.lang Package
Multithreaded Custom Class Loaders in Java SE 7
Java Programming Language
Binary Literals
Strings in switch Statements
The try-with-resources Statement
Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking
Underscores in Numeric Literals
Type Inference for Generic Instance Creation
Improved Compiler Warnings and Errors When Using Non-Reifiable Formal Parameters with Varargs Methods
Java Virtual Machine (JVM)
Java Virtual Machine Support for Non-Java Languages
Garbage-First Collector
Java HotSpot Virtual Machine Performance Enhancements
JDBC

All features please visit Oracle official site.

Beginning Java 02 – Install Eclipse IDE 1

This time we will try to install a Java IDE tool. For a Java beginner who never used Java development tools, to install a Java development environment is not that easy which you think.

But before we write any code, we need a tool to write the code, Simply, you can use anyone text editor to write a Java program, for example, you can use Notepad in Windows to write Java.

However, there are lots of professional IDE software which is free to use. The most popular IDE tool is Eclipse:
Eclipse is an open source community, whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.

(Why named Eclipse? An eclipse is in which the Moon passes through the shadow cast by Earth ? We don’t know now, maybe there was some reason, but we don’t want to spend more time to research where the name came from currently.)

You can download Eclipse IDE from their download page, However, if you are a Java beginner, you might be confused by their downloading list. see below screen shot from their site:

eclipse00

You can see there are at least 3 options you can choose for Java: Eclipse IDE for Java Developers; Eclipse IDE for Java EE Developers and Eclipse Classic. So what the difference are between them?

Eclipse group provides a compare page here:

eclipse01

Normally, for a Java beginner, you better choose Eclipse IDE for Java Developers or Eclipse Classic.

OK, after you downloaded a package, please unzip it, move the package to C:\eclipse folder is recommended by lots of developers.

By the way for our case, we downloaded the Eclipse IDE for Java Developers Windows 64 bits package.

Installation steps:

double click eclipse.exe file, we start to the installation:

eclipse02

Strange we see Eclipse is still a “Unknown Publisher”. But this is not important.

Just click the Run button, maybe you will see the following error message:

A Java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
C:\eclipse\jre\bin\javaw.exe
javaw.exe in your curent PATH

eclipse03

We really can not find C:\eclipse\jre folder. So let us go back to Eclipse’s download page to try find more information, At once we noticed there is a tips information on the right side of their page:

eclipse04

Then we come to the Java Runtime Environment web page. We read the following content:

The Eclipse IDE requires that a Java Runtime Environment (JRE) be installed on your machine to run. Java SE 5 or greater is recommended.

There are many different implementations of the Java Platform running atop a variety of operating systems. We focus Eclipse IDE testing on a handful of popular combinations of operating system and Java Platform; these are our reference platforms. Eclipse undoubtedly runs fine in many operating environments beyond the reference platforms we test. However, since we do not systematically test them we cannot vouch for them.

The Eclipse IDE is tested and validated on the following reference platforms:

eclipse05

We are using Windows 7 64-bit Operating System, so we choose the first line shown on above: the JRE from Sun’s Java 5 Update 22 or from IBM’s Java SR11.

Let us go to find Sun’s JRE now. The thing you have to know is that Oracle Corporation had acquired Sun Microsystems in 2009–2010, so we find the download  information on Oracle’s website:

eclipse06

When we click “Java Runtime Environment (JRE)”, we will be navigated to Java.com page

eclipse07 

Note:
If you click the “Free Java Download” button shown in above image , you will get a 32-bit JRE what ever your Windows 7 is 64-bit or 32-bit. But, since we are using Eclipse IDE for 64-bit Operating System, We should download a 64-bit JRE:

DO NOT click “Free Java Download” button, but look at left side on the same screen, click “All Java Downloads” link:

eclipse07_1

( Of course if you are using 32-bit OS, just click the “Free Java Download” button to continue. )

Now we will see a download page for All Java Downloads:

eclipse07_2

For our case, we downloaded “Windows 7, XP Offline (64-bit)”.

Let us stop here for this article. We will continue to discuss the left steps in our next article. Welcome back soon!

Hello World Example in Different Languages

If you are learning C, C++ or even Java, the first code example might be similar, they are all a example named Hello World.

We found a interesting article which collects all Hello World example in different languages.

For example:

In C:

#include <stdio.h>
 
int main(void)
{
  printf("Hello world\n");
  return 0;
}

In C++:

#include <iostream>
 
int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}

In Java:

public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello world!");
   }
}

Please read more in all other languages from Wikipedia

Beginning Java 01

Who made Java ?

James Gosling, Mike Sheridan and Patrick Naughton started to create the Java language project in June 1991.

Why created Java language project ?

Java was originally designed for interactive television, but seems it is “Over Qualified”, it is too advance for television industry at the time. Gosling aimed to implement a virtual machine and a language that had a familiar C/C++ style of notation.

Why named Java ?

Java was not called Java originally, it was Oak since there was an Oak tree was outside of James Gosling’ office. Later Oak changed to Green, finally named to Java from a list of random words. So we know the name Java was just from a choose randomly.

When the first Java version released ?

Sun Microsystems released the first public implementation as Java 1.0 in 1995. James Gosling was working for them at that time.

What is J2EE, J2ME, J2SE, Java EE, Java ME, Java SE ?

Simply, J2EE targeted enterprise applications, J2ME is for mobile applications (Mobile Java). J2SE designated the Standard Edition. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

Java Icon ?

322px-java-logo.svg-1         java_logo

Java supports C++ style pointers?

Like C# (Actually C# learn from Java, but Java originally learn lots of stuff from C++), Java does not support C/C++ style pointer arithmetic.

Default file extension name?

A suffix .java

“main” is NOT a keyword in Java.

The method name "main" is not a keyword in the Java language (Actually in C#, “main” is not a keyword either, but normally in C# we use Main (capital) for a method name). Java classes that run in managed environments such as applets and Enterprise JavaBean do not use or need a main() method. A java program may contain multiple classes that have main methods, which means that the VM needs to be explicitly told which class to launch from.

What is JRE?

JRE is Java Runtime Environment. End-users use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or in a Web browser for Java applets.

What is JDK?

JDK is Java Development Kit. Sun distributes a superset of the JRE called JDK, which includes development tools such as the Java compiler, Javadoc, Jar, and debugger.

Java Target platforms.

Sun defined four editions of Java targeting platforms:

Java Card —  which is for smartcards.
Java ME — Java Platform, Micro Edition,  targeting environments with limited resources.
Java SE — Java Platform, Standard Edition, targeting workstation environments.
Java EE — Java Platform, Enterprise Edition, targeting large distributed enterprise or Internet environments.