Search This Blog

Wednesday, March 24, 2010

Portable Windows Application for ALL

This article is about portable windows application installation in any portable hard disk (PEN drive, Portable Hard disk).
I am a frequent reader of Hindu News paper (daily). Last Monday (22-March-2010) education plus edition they published an article under the title of “Simple solution in a ‘flash’” (URL: http://beta.thehindu.com/education/article245438.ece).
Whom it’s used?
It’s extremely use full for developer/manager at the point of client demo or student for presentation.

Where to get in cloud?
Refer the http://portableapps.com/ for details information about the portable application.

What are the application are supported?
Refer the http://portableapps.com/apps for supported products.

Its will support the different types of portable application very from web browser, office, games application.

I don’t want to explain the further details because all details are available under the
http://portableapps.com/ URL.


Feed back are welcome.

Regards,
Marimuthu Rajagopal.
(Passion for Software Product Development)

Tuesday, March 16, 2010

Java Virtual Machine(JVM) in Java for Beginners

Today I am going to answer what is Java Virtual machine?

I am working with the Java from my school days (2000). But I admire why java is very popular than other programming language.

The answer I have got from my teacher is Platform Independent.

Then asked next question is what is platform Independent?

Compiled Java file (.class) can be run in any operating system. It’s not possible using C, C++ because those language uses different compiler for different operating system.

This answer is acceptable in the point of the end user but as a programmer I expected to know more.

So I asked what the class file contains.

He smiled and answered it contains byte code. The byte code is intercepted by the Java Virtual machine (JVM) (System software) program written by sun micro system for different Operating system. The JVM covert s the received byte code to running operating system understandable format.

Finally I land up in started asking what Java Virtual machine is.

My teacher told me go and Refer the Java Spec. Because he is having idea but it can be false information without referring java spec.

Finally I have Refer the Book inside the Java Virtual Machine, 1997.chm by Bill Venners.

Java Virtual Machine:

Heart of the Java is Java virtual machine. Below features are achieved using JVM.

1. Platform Independence

2. Security

3. Network Mobility.

Here we discuss about how we are achieving Platform independence.

What is Java Virtual Machine?

JVM is an abstract computer. It’s nothing but the system software (Program for Interaction with Computer chip).

Main Job of the JVM is load the class files and executes the bytecodes with the help of class loader program.

The class loader program is responsible for loading application class file and required supporting java API.


The Execution Engine which is responsible for executing received byte to the operating understandable format.

There are types of execution engine are

1. Simplest Execution engine- converts the Byte code to the machine understandable code.

2. Just In Time compiler (JTC)–Here byte code of a method are compiled native machine code first time the method invoke. The native machine code for the method is then cached, so it can be re-used the next time that same method is invoked.

Conclusion:

On a Java Virtual Machine built on top of a chip that executes Java byte codes natively, the execution engine is actually embedded in the chip.

So the JVM is the Combination of Class loader and execution engine

Mathematical representation

JVM=Class loader + Execution engine.

Exceution engine=Simplest Execution engine/Just in Time Compiler (JTC).


Need feed back for further improvement.


Regards,

Marimuthu Rajagopal.




Monday, March 15, 2010

It’s possible to create the Object for the interface?

It’s possible to create the Object for the interface?

When working with smartcard project, I have come across the requirement to filter the only .doc file from a directory in a file array.

For that I have used the following classes and interfaces are:

1. File-Class

2. FileFilter-Interface.

I have created the Object for the FileFilter interface as below.

static FileFilter fileFilter=new FileFilter() {

public boolean accept(File pathname) {

System.out.println("with in accept");

String filename=pathname.getName();

if(filename.endsWith(".doc"))

{

return Boolean.TRUE;

}

return Boolean.FALSE;

// throw new UnsupportedOperationException("Not supported yet.");

}

};

Passed the file filter instance to the listFiles method of File class to get the only .doc file array.

as below.

File directory=new File("C:/Documents and Settings/Marimuthu/Desktop/download");

File[] filearray=directory.listFiles(fileFilter);

for(File docfile:filearray)

{

System.out.println("docfilename="+docfile.getName());

}

So finally I got the only File array that contains only doc files.

Code for File Filter:

public class SampleFileFilter{

static FileFilter fileFilter=new FileFilter() {

public boolean accept(File pathname) {

System.out.println("with in accept");

String filename=pathname.getName();

if(filename.endsWith(".doc"))

{

return Boolean.TRUE;

}

return Boolean.FALSE;

// throw new UnsupportedOperationException("Not supported yet.");

}

};

public static void main(String arg[])

{

File directory=new File("C:/Documents and Settings/Marimuthu/Desktop/download");

File[] filearray=directory.listFiles(fileFilter);

for(File docfile:filearray)

{

System.out.println("docfilename="+docfile.getName());

}

}

}

But it’s can’t be understandable by Beginners so I have created separate sample interface object.

Sample for Begineer:

Code for Interface:

package com.blogspot.microtechinfo.java.exploration;

/**

*

* @author Marimuthu

*/

public interface SampleInterface {

public void createObject();

}

Code for Class:

package com.blogspot.microtechinfo.java.exploration;

/**

*

* @author Marimuthu

*/

public class SampleClass {

/*Create Reference for the SampleInterface

*

*/

static SampleInterface sampleInterface=new SampleInterface() {

/////////Implementation of the createObject method.

public void createObject() {

System.out.println("Ya! Ya! Its possible to create Object for Interface");

//throw new UnsupportedOperationException("Not supported yet.");

}

};

public static void main(String arg[])

{

//////////Use the smapleInterface reference to call the create object method

sampleInterface.createObject();

}

}

Conclusion:

Finally we can create the object for the interface also.

Thanks & Regards,

Marimuthu Rajagopal