Loading jndi.properties file from specific path

         Context context = null;
         try {
                File configFile = new File(“<provide absolute path to your my.jndi.properties file>“);
                Properties prop = new Properties();
                FileInputStream istream = new FileInputStream(configFile);
                context = new InitialContext(prop);
            } catch (NamingException e1) {
                // TODO Auto-generated catch block
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
            } catch (IOException e) {
                // TODO Auto-generated catch block


Decompile java class using eclipse plugin

Step 1: Download the JAD zip file and extract (you already have done this step for command line example).

download JAD from:



Step 2: Download the JAD Eclipse Plugin from SourceForge Website – Download Link.

The plugin is – net.sf.jadclipse_3.3.0.jar

Step 3: Put the JadClipse JAR file(net.sf.jadclipse_3.3.0.jar) into the plugins folder of your Eclipse installation.

Step 4: Restart the eclipse

Step 5: In Eclipse > Go to Window > Preferences… > General > Editors > File Associations and make sure that the JadClipse Class File Viewer has the default file association for *.class files and click Apply button.

Step 6: Configure the path to the Jad executable (jad.exe) – check Step 1 for the path of your jad.exe

In Eclipse > Go to Window > Preferences… >Java > JadEclipse > Type Jad’s path in “Path to Decompiler” field.

Step 7: Test the JAD in Eclipse

In Eclipse IDE, navigate to any class which does not have the source code and press F3 key, JAD will decompile it automatically and opens in a editor on right panel of the Eclipse IDE.


Common Errors:


The Class File Viewer cannot handle the given input (‘org.eclipse.ui.ide.FileStoreEditorInput’).


I was able to fix it by adding the folder that contains the class file(s) as a “Class Folder” under Project Properties => Java Build Path => Libraries => Add Class Folder.

Once I did that, I was able to decompile all the sources properly –  it needs to be part of your workspace.

Java Collections contains Substring

By default list.contains(“String”) check for complete match in each line, so searching for list.contain(“ing”) would return false.

This is what I did for solution:

Convert list collection to String and then search in this complete Collection String contains our substring “ing”

Example: sample code below list elements in list1 that are not present in list2.  Also while comparing it compares only for first 7 characters

String x = list2.toString();
for(String a:list1){
   String b = a.substring(0,7);