Feeds:
Posts
Comments

A static initializer block will execute when a class is initialized — right after the class is loaded. This will happen (basically) the first time the class is referenced in the program. No instances need to be created. The static block will only be executed once (or in any case, only once each time the class is loaded.)

A constructor executes when, and only when, the “new” operator is used, or the Class.newInstance() or Constructor.newInstance() methods are called.

Moreover,

static block will execute first irrespective of if constructor is written or not.

order will always be static first and then constructor or any method.

Happy Thought

If you see someone without a smile, remember to give them one of yours!

Happy Thought

Happiest Morning to all!

Happiest Minds…
Healthiest Hearts…
Harmonious Lives.

Be happy. Stay healthy. Live in harmony.

A scripting language is a form of programming language that is usually interpreted rather than compiled. Conventional programs are converted permanently into executable files before they are run. In contrast, programs in scripting language are interpreted one command at a time

A high-level programming language that is interpreted by another program at runtime rather than compiled by the computer’s processor as other programming languages (such as C and C++) are. Scripting languages, which can be embedded within HTML, commonly are used to add functionality to a Web page, such as different menu styles or graphic displays or to serve dynamic advertisements. These types of languages are client-side scripting languages, affecting the data that the end user sees in a browser window. Other scripting languages are server-side scripting languages that manipulate the data, usually in a database, on the server.

Scripting languages came about largely because of the development of the Internet as a communications tool. JavaScript, ASP, JSP, PHP, Perl, Tcl and Python are examples of scripting languages.

The PATH variable contains directories where binary files (e.g. EXE files in Windows) will be looked for.
If you open a command prompt and type “javac”, you’re supposed to have the “bin” directory of your sdk into the PATH, otherwise you’ll get an infamous “Command not found” error message.

The CLASSPATH contains directories (or JAR files), from where your java compiler/runtime will look for .class files (and some others).
For example, “java Hello.class” will not work unless you set the directory (or JAR file) Hello.class is in, into your CLASSPATH.

To conclude,

“path” is used by the Operating System to find executable files.

“classpath” is used by the JVM to find .class files.

Portability Each kind of computer has its unique instruction set. While some processors include the instructions for their predecessors, it’s generally true that a program that runs on one kind of computer won’t run on any other. Add in the services provided by the operating system, which each system describes in its own unique way, and you have a compatibility problem. In general, you can’t write and compile a program for one kind of system and run it on any other without a lot of work. Java gets around this limitation by inserting its virtual machine between the application and the real environment (computer + operating system). If an application is compiled to Java byte code and that byte code is interpreted the same way in every environment then you can write a single program which will work on all the different platforms where Java is supported. (That’s the theory, anyway. In practice there are always small incompatibilities lying in wait for the programmer.)

  • Platform independence
  • Can create any number of programming languages (syntax) and have them compile down to the same bytecode.
  • Could easily create cross language converters
  • x86, x64, and IA64 no longer need to be compiled as seperate binaries. Only the proper virtual machine needs to be installed.
  • Each OS simply needs to create a virtual machine and it will have support for the same program.
  • Just in time compilation allows you to update a program just by replacing a single patched source file. (Very beneficial for web pages)

A platform is the hardware or software environment in which a program runs. We’ve already mentioned some of the most popular platforms like Microsoft Windows, Linux, Solaris OS, and Mac OS. Most platforms can be described as a combination of the operating system and underlying hardware. The Java platform differs from most other platforms in that it’s a software-only platform that runs on top of other hardware-based platforms.

The Java platform has two components:

  • The Java Virtual Machine
  • The Java Application Programming Interface (API)

The API is a large collection of ready-made software components that provide many useful capabilities. It is grouped into libraries of related classes and interfaces; these libraries are known as packages.

Every full implementation of the Java platform gives you the following features:

Development Tools The development tools provide everything you’ll need for compiling, running, monitoring, debugging, and documenting your applications. As a new developer, the main tools you’ll be using are the javac compiler, the java launcher, and the javadoc documentation tool.

Application Programming Interface (API) The API provides the core functionality of the Java programming language. It offers a wide array of useful classes ready for use in your own applications. The core API is very large; to get an overview of what it contains, view the Java SE Development Kit 6 (JDK 6) documentation.

Deployment Technologies The JDK software provides standard mechanisms such as the Java Web Start software and Java Plug-In software for deploying your applications to end users.

User Interface Toolkits The Swing and Java 2D toolkits make it possible to create sophisticated Graphical User Interfaces (GUIs).

Integration Libraries Integration libraries such as the Java IDL API, JDBC API, Java Naming and Directory Interface (“J.N.D.I.”) API, Java RMI, and Java Remote Method Invocation over Internet Inter-ORB Protocol Technology (Java RMI-IIOP Technology) enable database access and manipulation of remote objects.

Why Java?

Get started quickly Although the Java programming language is a powerful object-oriented language, it’s easy to learn, especially for programmers already familiar with C or C++.

Write less code Comparisons of program metrics (class counts, method counts, and so on) suggest that a program written in the Java programming language can be four times smaller than the same program written in C++.

Write better code The Java programming language encourages good coding practices, and automatic garbage collection helps you avoid memory leaks. Its object orientation, its JavaBeans component architecture, and its wide-ranging, easily extendible API let you reuse existing, tested code and introduce fewer bugs.

Develop programs more quickly The Java programming language is simpler than C++, and as such, your development time could be up to twice as fast when writing in it. Your programs will also require fewer lines of code.

Avoid platform dependencies You can keep your program portable by avoiding the use of libraries written in other languages.

Write once, run anywhere Because applications written in the Java programming language are compiled into machine-independent bytecodes, they run consistently on any Java platform.

Distribute software more easily With Java Web Start software, users will be able to launch your applications with a single click of the mouse. An automatic version check at startup ensures that users are always up to date with the latest version of your software. If an update is available, the Java Web Start software will automatically update their installation.

JVM:

The use of the JVM is simple : – To change the byte code into the machine specific code. So the JVM converts the byte code(ie the code which we get when we compile the .java class) into the code that your machine/OS understands.

JVM is machine specific. So JVM for windows will be different from JVM for Mac or Unix. JVM is one of the most crucial part in the java engine. It is due to JVM only that we say java code is “Compile Once, Run Anywhere” programming language.

The byte code generated when we compile the code will be THE SAME doesn’t matter we compiled the code in Windows OS or some other. However, JVM makes sure that the byte code should be interpreted properly in the OS under concerned so interpret the byte code differently for different OS

JRE:

JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc) + runtime libraries.

Bytecode will be understood by the JRE with the help of JVM.

A JVM is just the thing that executes .class files. A JRE includes libraries and APIs (i.e., all the java.* and javax.* Java classes, plus things like the native libaries needed for the AWT to function.) So a JRE is a JVM plus more stuff. You can’t actually run a program on a bare JVM; there are a few APIs (the java.lang package, in particular) which the JVM can’t function without.

JDK:

Java Developer Kit contains tools needed to develop the Java programs, and JRE to run the programs. The tools include compiler (javac.exe), Java application launcher (java.exe), Appletviewer, etc…

JDK = JVM + JRE

Compiler(javasc.exe) converts java code into byte code. Java application launcher(java.exe) opens a JRE, loads the class, and invokes its main method.

You need JDK, if at all you want to write your own programs, and to compile them. For running java programs, JRE is sufficient.

To conclude,

In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodesthe machine language of the Java Virtual Machine (Java VM).[2] The java launcher tool then runs your application with an instance of the Java Virtual Machine.

  • Right click on CHM file saved to your Computer in Windows Explorer select “Properties” on the General tab and click “Unblock” button.

 

  • Sometimes unregistered HTML Help viewer component can also causes this problem, try to register it by running command in command prompt “regsvr32 hhctrl.ocx”.

 

Weird and Funny, but works;

 

  • When you do, open with -> .chm file, uncheck the “Always ask before opening this file” . That solved the issue for me.

« Newer Posts - Older Posts »