java specifying jar file while running program from command line

Solution:

Spent one whole day to figure out semicolon(;) in windows is equivalent to specifying colon(:) on unix platform.

If all of the jars are placed into a folder called ‘jars’ in the current directory.

on Windows –> java -cp .;jars/* AbsoluteClassname arguments

Unix –> java -cp .:jars/* AbsoluteClassname arguments

 

Problem:

Exception in thread “main” java.lang.NoClassDefFoundError:

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:

http://www.varaneckas.com/jad/

http://www.softpedia.com/get/Programming/Debuggers-Decompilers-Dissasemblers/JAD.shtml

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:

Problem1:

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

Solution1:

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);
   if(!x.contains(b))
       System.out.println(a);
}

RHC Openshift

Problem – not able to rhc ssh to application on windows

c:\>rhc ssh <appname>

No system SSH available. Please use the –ssh option to specify the path to your

 

SSH executable, or install SSH.

Solution

Reinstall Git with ‘Use Git and optional Unix tools from the Windows Command Prompt‘ option for Git and SSH operations, shown below:

GitInstall_AddToPath

 

Problem – Application url displaying 503 error

Solution

it may be due to Tomcat/Jboss server crash, in such situations to restart the webserver please run
c:\>rhc cartridge-restart --cartridge jboss -a appname

Quotes

  • Health is the crown on the well mans head that only an ill man can see.
  • You will never achieve true personal greatness unless you hold yourself to a higher standard than you hold others.
  • With all the new and different mistakes out there waiting to be made, why keep repeating the old ones?

  • There is not enough time to make all the mistakes yourself, so learn from the mistakes of others.
  • I hope I’m never in a survival situation; I may just like it’s simplicity and decide to stay there.
  • Those that give up liberty for safety deserve neither.
  • When ever there is a confusion to decide over something, listen to the heart not the mind.