Java Interview questions

Monday, 20 October 2008, 16:31 | Category : Java
Tags : ,

Here a few Java Interview questions. Divided in three different categories:  Basic, Intermediate,  Advanced. Basic Q – Can a class have it’s main method declared as private? A – Yes, the program will compile but fail at runtime. Q – What if the static modifier is removed from the signature of the main method? A […]

Email Marketing Tool Application

Friday, 7 September 2007, 2:10 | Category : Internet, Java, Technology
Tags : , , ,

Read the documentation Here

Sending huge data to client browser

Wednesday, 20 June 2007, 0:56 | Category : Internet, J2EE, Java, Technology
Tags :

If you want to pass huge data to the client from your servlet, user may need to wait till the ServletOutputStream or JSPWriter flushes the data. This happens generally whenever you have a number of items page and you want to pass it to the client. The better approach is to flush the data partly […]

How to Enable remote debugging of a java application

Friday, 8 June 2007, 2:50 | Category : Java, Technology
Tags :

While running the application pass following as JVM argument -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8765 This will start listening on port 8765, now you may attach remote debugger from any machine giving the IP/hostname and port.

Executing Javascript in Java code

Monday, 4 June 2007, 13:52 | Category : Java, Javascript, Technology
Tags :

you need follwing libraries to use javascript code in java. 1. Apache BSF : 2. Mozilla Rhino : Sample Code:

Using WorkManager in JBoss

Friday, 27 April 2007, 23:00 | Category : J2EE, Java, Technology
Tags :

You can schedule any work (thread that needs to be run) in Jboss using WorkManager API (JCA). Below is a sample code that can be called from any ejb/servlet/mdb or any server side application running in jboss container.

Class Loading in Java

Friday, 27 April 2007, 14:09 | Category : Java
Tags :

Class loaders are hierarchical. Classes are introduced into the JVM as they are referenced by name in a class that is already running in the JVM. So how is the very first class loaded? The very first class is specially loaded with the help of static main() method declared in your class. All the subsequently […]

Reading Mails from secure exchange server in Java

Thursday, 26 April 2007, 16:46 | Category : Internet, J2EE, Java, Technology
Tags : , ,

1. Export the certificate for the exchange server from Internet explorer Certificate export wizard e.g. after opening, (View certificate >Details > Copy to File). Say the exported file name is certificate.cer 2. Create keystore from the certificate using java keytool (which will create keystore file in current directory). It will ask for a password, […]

Export File name in servlet/jsp

Thursday, 26 April 2007, 13:49 | Category : Internet, J2EE, Java, Technology
Tags :

While giving a link for export as a file, you may also want to give it a name that should come in save-as dialog or browser. To do so, you have to just set Content-Disposition header and content type of response e.g. for saving as an excel file, following can be used:

Debugging problems related to the JDBC API

Thursday, 26 April 2007, 0:57 | Category : Database, J2EE, Java, Technology
Tags :

A good way to find out what JDBC calls are doing is to enable JDBC tracing. The JDBC trace contains a detailed listing of the activity occurring in the system that is related to JDBC operations. If you use the DriverManager facility to establish your database connection, you use the DriverManager.setLogWriter method to enable tracing […]