How Java Changed the Internet

 

The Internet helped catapult Java to the forefront of programming, and Java, in turn, had a profound effect on the Internet. In addition to simplifying web programming in general, Java innovated a new type of networked program called the applet that changed the way the online world thought about content. Java also addressed some of the thorniest issues associated with the Internet: portability and security. Let’s look more closely at each of these.

Java Applets

An applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed by a Java-compatible web browser. Furthermore, an applet is downloaded on demand, without further interaction with the user. If the user clicks a link that contains an applet, the applet will be automatically downloaded and run in the browser. Applets are intended to be small programs. They are typically used to display data provided by the server, handle user input, or provide simple functions, such as a loan calculator, that execute locally, rather than on the server. In essence, the applet allows some functionality to be moved from the server to the client.

The creation of the applet changed Internet programming because it expanded the universe of objects that can move about freely in cyberspace. In general, there are two very broad categories of objects that are transmitted between the server and the client: passive information and dynamic, active programs. For example, when you read your e-mail, you are viewing passive data. Even when you download a program, the program’s code is still only passive data until you execute it. By contrast, the applet is a dynamic, self-executing program. Such a program is an active agent on the client computer, yet it is initiated by the server. As desirable as dynamic, networked programs are, they also present serious problems in the areas of security and portability. Obviously, a program that downloads and executes automatically on the client computer must be prevented from doing harm. It must also be able to run in a variety of different environments and under different operating systems.

Security

As you are likely aware, every time you download a “normal” program, you are taking a risk, because the code you are downloading might contain a virus, Trojan horse, or other harmful code. At the core of the problem is the fact that malicious code can cause its damage because it has gained unauthorized access to system resources. For example, a virus program might gather private information, such as credit card numbers, bank account balances, and passwords, by searching the contents of your computer’s local file system. In order for Java to enable applets to be downloaded and executed on the client computer safely, it was necessary to prevent an applet from launching such an attack.

Java achieved this protection by confining an applet to the Java execution environment and not allowing it access to other parts of the computer. The ability to download applets with confidence that no harm will be done and that no security will be breached is considered by many to be the single most innovative aspect of Java.

Portability

Portability is a major aspect of the Internet because there are many different types of computers and operating systems connected to it. If a Java program were to be run on virtually any computer connected to the Internet, there needed to be some way to enable that program to execute on different systems. For example, in the case of an applet, the same applet must be able to be downloaded and executed by the wide variety of CPUs, operating systems, and browsers connected to the Internet. It is not practical to have different versions of the applet for different computers. The same code must work on all computers. Therefore, some means of generating portable executable code was needed.

 

 

Java and C++

Although Java was modelled after C++ languages, it differs from C++ in many ways.

 

  • Java does not support operator overloading
  • Java do not have template classes as in C++
  • Java does not support multiple inheritances of classes. This is accomplished using a new feature called “interface”
  • Java does not support global variables. Every variable and method is declared within a class and forms the part of that class
  • Java does not use pointers
  • Java has replaced the destructor function with a finalize () function
  • There are no header files in Java

 

Features of Java

  1. Compiled and Interpreted – Usually a language either is compiled or is interpreted. However, Java is both complied and interpreted and has two – stage systems. First, Java compiler translates source code into what is known as byte code instructions. Byte codes are not machine instructions and therefore, in the second stage, Java interpreter generates machine code that can be directly executed by the machine that is running the Java program.
  2. Platform Independent and Portable – The most significant contribution of Java over the other languages is its portability. Java programs can be easily moved from one computer to another computer, anywhere and anytime. Changes and upgrades in the Operating System do not affect the programs written in Java. This is the reason why Java is popular in developing Internet applications where different kinds of system are connected worldwide. Java also ensures portability. Firstly, when the compiler generates byte codes, it can be implemented on any machine. Secondly, the size of the primitive data types is machine independent.
  3. Object – Oriented – Java is a true OOP. Almost everything in Java is Object. All program code and data reside within objects and classes. Java comes with an extensive set of classes, arranged in packages that we can use in our programs by inheritance. The object model in Java is simple and easy to extend.
  4. Robust and secure – Java is a robust language. It provides many safeguards to ensure reliable code. It has strict compile time and run time checking for data types. It is designed as garbage – collected language relieving the programmer virtually all memory management problems. Java also incorporates the concept of exception handling which captures series errors and eliminates any risk of crashing the system. Security becomes an important issue for a language that is used for programming on Internet. Threat of viruses and abuse of resources are everywhere. Java systems not only verify all memory access but also ensure that no viruses are communicated with an applet. The absence of pointers in Java ensures that programs cannot gain access to memory locations without proper authorization.
  5. Distributed – Java is designed as a distributed language for creating applications on networks. It has the ability to share both data and programs. Java applications can open and access remote objects on Internet as easily as they can do in a local system. This enables multiple programmers’ remote locations to collaborate and work together on a single project.
  6. Simple, Small and Familiar – Java is a small and simple language. Many features of C and C++ that are either redundant or sources of unreliable code are not part of Java. For example, Java does not use pointers, pre-processor header files, goto statement and many others. It also eliminates operator overloading and multiple inheritance. Familiarity is another striking feature of Java. To make a language look familiar to the existing programmers, it was modelled on C and C++ languages. Java uses many constructs of C and C++ and therefore, Java code looks like C++. In Fact, Java is a simplified version of C++.
  7. Multithreaded and Interactive – It means handling multiple tasks simultaneously. Java supports multithreaded programming. This means we need not wait for the application to finish one task before beginning another. This feature greatly improves the interactive performance of the applications. The Java runtime comes with the tools that support multi process synchronization and construct smoothly running interactive systems.
  8. High performance – Java performance is impressive for an interpreted language, mainly due to the use of intermediate byte code. According to Sun, Java speed is comparable to the native C/C++. Java architecture is also designed to reduce the overheads during runtime. Further, the incorporation of multithreading enhances the overall execution speed of Java programs.
  9. Dynamic and Extensible – Java is a dynamic language. Java is capable of dynamically linking in new class libraries, methods, and objects. Java can also determine the type of class through a query, making it possible to either dynamically link or abort the program, depending on the response. Java programs support functions written in other languages such as C and C++. These functions are known as native methods. This facility enables the programmers to use the efficient functions available in these languages. Native methods are linked dynamically at runtime.
  10. Ease of Development – Java 2 Standard Edition (J2SE) 5.0 supports features, such as Generics, Enhanced for loop, Autoboxing or unboxing, Typesafe Enums, Varage, Static import and Annotation. These features reduce the work of the programmer by shifting the responsibility of creating the reusable code to the compiler. The resulting source code\is free from the bugs because the errors made by the compiler are less when compared to those made by the programmers. Thus, each of the linguistic feature is designed to develop Java program in an easier way
  11. Scalability and Performance – J2SE 5.0 assures a significant increase in stability and performance by improving the start-up time and reducing the amount of memory used in Java 2 runtime environment. For example, the introduction of the class, data sharing in the Hotspot Java Virtual Machine (JVM) improves the start-up time by loading the core classes from the jar files into a shared archive. Memory utilization is reduced by sharing data in the shared archive among multiple JVM processes. In the earlier versions, the data was represented in each JVM instance.
  12. Monitoring and Manageability – Java supports a number of APIs, such as JVM Monitoring and Management API, Sun Management Platform Extension, Logging, Monitoring and Management Interface, and Java Management Extension (JMX) to monitor and manage Java applications. For example, Java provides JVM Monitoring and Management API to track the information at the application level and JVM level when deploying a large application. Java provides tools, such as jconsole, jps, jstat, and jstatd to make use of monitoring and management facilities. For example, GUI based tool called jconsole is used to monitor the JVM.
  13. Desktop Client – J2SE 5.0 provides enhanced features to meet the requirements and challenges of Java desktop users. It provides an improvised Swing look and feel the Ocean. This feature is mainly used for developing graphics applications that require OpenGL hardware acceleration.

 

Introduction

You use word processors to write documents, Web browsers to explore the Internet, and email programs to send email. These are all examples of software that runs on computers. If you take a computer right from the factory and give no instructions to this computer, the computer can’t do word processing, the computer can’t surf the Web, and it can’t do anything. All a computer can do is follow the instructions that people give to it. The group of instructions is a program. A group of program or code is known as Software. Software is developed using programming languages.

There are many programming languages that can be used for developing programs but why Java?

The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future of computing is being profoundly influenced by the Internet, and Java promises to remain a big part of that future. Java is the Internet programming language and one of the most powerful programming languages.

Java has become enormously popular. Its rapid rise and wide acceptance can be traced to its design characteristics, particularly its promise that you can write a program once and run it anywhere. As stated by Sun, Java is simple, object oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high performance, multithreaded, and dynamic.

Java is a full-featured, general-purpose programming language that can be used to develop robust mission-critical applications. Today, it is employed not only for Web programming, but also for developing standalone applications across platforms on servers, desktops, and mobile devices. It was used to develop the code to communicate with and control the robotic rover on Mars. Many companies that once considered Java to be more hype than substance are now using it to create distributed applications accessed by customers and partners across the Internet. For every new project being developed today, companies are asking how they can use Java to make their work easier.

Java is a mature programming language that is easy to learn. At the same time it is also a vast collection of technologies that are so diverse that beginners often don’t know where to start.

With the development of Java, applications have never been easier or faster. The aim of the Java is to provide developers with a powerful set of APIs while shortening development time, reducing application complexity, and improving application performance.

Java is not only an object-oriented programming language; it is also a set of technologies that make software development more rapid and resulting applications more robust and secure. For years Java has been the technology of choice because of the benefits it offers:

  • platform independence
  • ease of use
  • complete libraries that speed up application
  • development
  • security
  • scalability
  • extensive industry support

Sun Microsystems introduced Java in 1995 which was developed by team led by James Gosling and Java (which was known as Oak) – were used in embedded chips in consumer electronic appliances. In 1995, it was renamed as Java, and it was redesigned for developing Internet appliances. The growth of the Internet had much to contribute to the early success of Java.

Having said that, applets were not the only factor that made Java shine. The other most appealing feature of Java was its platform-independence promise, hence the slogan “Write Once, Run Anywhere.” What this means is the very same program you write will run on Windows, Unix, Mac, Linux, and other operating systems. This was something no other programming language could do. At that time, C and C++ were the two most commonly used languages for developing serious applications. Java seemed to have stolen their thunder since its first birthday.

That was Java version 1.0.

In 1997, Java 1.1 was released, adding significant features such as a better event model, Java Beans, and internationalization to the original.

Java 1.2 was launched in December 1998. Three days after it was released, the version number was changed to 2, marking the beginning of a huge marketing campaign that started in 1999 to sell Java as the “next generation” technology. Java 2 was sold in four flavors: the Standard Edition (J2SE), the Enterprise Edition (J2EE), the Micro Edition (J2ME), and Java Card (that never adopted “2” in its brand name).

The next version released in 2000 was 1.3, hence J2SE 1.3. 1.4 came two years later to make J2SE 1.4. J2SE version 1.5 was released in 2004. However, the name Java 2 version 1.5 was then changed to Java 5.

On November 13, 2006, a month before the official release date of Java 6, Sun Microsystems announced that it had open-sourced Java. Java SE 6 was the first Java release for which Sun Microsystems had invited outside developers to contribute code and help fix bugs. True that the company had in the past accepted contributions from non-employees, like the work of Doug Lea on multithreading, but this was the first time Sun had posted an open invitation. The company admitted that they had limited resources, and outside contributors would help them cross the finish line sooner.

In May 2007 Sun released its Java source code to the OpenJDK community as free software. IBM, Oracle and Apple later joined OpenJDK.

In 2010 Oracle acquired Sun.

Java 7, code-named Dolphin, was released in July 2011 and a result of open-source collaboration through OpenJDK.

In traditional programming, source code is compiled into executable code. This executable code can run only on the platform it is intended to run. In other words, code written and compiled for Windows will only run on Windows, code written in Linux will only run on Linux, and so on.

A Java program, on the other hand, is compiled to byte code. You cannot run byte code by itself because it is not native code. Byte code can only run on a Java Virtual Machine (JVM). A JVM is a native application that interprets byte code. By making the JVM available on many platforms, Sun transformed Java into a cross-platform language. The very same byte code can run on any operating system for which a JVM has been developed.