How to display UTF-8 characters in Eclipse / RAD Console

The default setting in your Eclipse or IBM Rational Application Developer console does not support UTF-8. You have to turn it on your self in the preferences. The following diagram shows how you can do it.

Open our IDE Preferences and go to General > Workspace Then underneath Text file encoding, change the value from Default (cp15252) to UTF-8. If you are looking for other character sets, there are some options in the drop down as well.

Once you turn this feature on, you can have your program spit out UTF-8 characters to your console and the console should be able to display those characters without a problem. Here is a screenshot from my machine when I did this change.

Sample WSDL File Created By Apache Axix 1.3 From A Simple Java File

This is not a WSDL tutorial. I am simply posting a simple Java file and the corresponding WSDL file created by Apache Axix 1.3. This was done using IBM’s Rational Software Architect (RSA) which is equivalent to eclipse IDE.

The java file:

package com.webservice;

public class HelloWebservice {
	
	public String sayHello (String name)
	{
		return "Hello"+name;
	}

}

The above file was converted to WSDL file by Apache Axix 1.3. The following is the generated .wsdl file.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webservice.com" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="http://webservice.com" xmlns:intf="http://webservice.com" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="http://webservice.com" 
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="sayHello">
    <complexType>
     <sequence>
      <element name="name" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="sayHelloResponse">
    <complexType>
     <sequence>
      <element name="sayHelloReturn" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>
   <wsdl:message name="sayHelloResponse">
      <wsdl:part element="intf:sayHelloResponse" name="parameters"/>
   </wsdl:message>
   <wsdl:message name="sayHelloRequest">
      <wsdl:part element="intf:sayHello" name="parameters"/>
   </wsdl:message>
   <wsdl:portType name="HelloWebservice">
      <wsdl:operation name="sayHello">
         <wsdl:input message="intf:sayHelloRequest" name="sayHelloRequest"/>
         <wsdl:output message="intf:sayHelloResponse" name="sayHelloResponse"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="HelloWebserviceSoapBinding" type="intf:HelloWebservice">
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="sayHello">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="sayHelloRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="sayHelloResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="HelloWebserviceService">
      <wsdl:port binding="intf:HelloWebserviceSoapBinding" name="HelloWebservice">
         <wsdlsoap:address location="http://localhost:8080/WebServiceTutorial/services/HelloWebservice"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

How To Set Conditional Debug Breakpoints in Eclipse or IBM RAD?

Developers and Production Support Analysts will, in their lifetime, spend a lot of time debugging, specially if the applicaiton is complex and they have no idea on what’s going on. I mentioned Production Support Analysts because they are the ones in most companies analyzing and fixing the defects in production environments. Developing the new features probably does not need you as much to debug as it needs for maintenance work, specially if you are trying to understand what’s going on and what is the flow.

There are many occasions you don’t want to debug every steps. For example, if there is a for loop that loops for a 1000 times and that you know it fails on the 100th step or are intersted to see what’s going on somewhere around that, would it make sense to go through the 99 steps of debugging before hitting the 100th one? It certainly does not make sense to me unless you have a lot of time to hit those debug short cuts (I love those F5,F6,F7,F8 shortcut keys in Eclipse and IBM RAD by the way).

So what can you do about it? Well the IDEs like Eclipse or IBM RAD offer you a way to set conditional breakpoints – the IDE will stop at the breakpoint you set only when certain conditons are met.

The following is some piece of code with a for-loop. Let’s say we are interested to look at the value of the variable ‘random’ when the value of i is 100.

package com.kushal.tools.published;
/**
 * @author Kushal Paudyal
 * www.sanjaal.com/java
 * www.icodejava.com
 * 
 * Written to be used in a tutorial to show how to do 
 * conditional break points in eclipse
 */

public class ConditionalBreakPointEclipse {

    public static void main(String args[]) {

        doSomeStuff();
    }

    /** Just outputting some random numbers. We would like to
     * add a conditional breakpoint when the value of i is 100.
     */
    public static void doSomeStuff() {

        for (int i = 0; i <= 1000; i++) {

            double random = i * Math.random();

            System.out.println(i + " - Random - " + random);
        }
    }

}

The first step is to set a breakpoint where it says

double random = i * Math.random();

Here is a screenshot for that.

Eclipse - Putting a breakpoint

The second step is to right click on the breakpoint and choose ‘Breakpoint Properties…’.

Eclipse - right click on the breakpoint

On the third step, enable the checkbox ‘Conditional’. The text area underneath the checkbox will be enabled and that is a place where you can put your conditions. In my case, I simply typed in i==100 because I wanted to stop when the value of i is 100.

Eclipse - Adding the conditional in the Line Breakpoint Properties

Now close the window and run the application in debug mode. You will see that after the value of i reaches 100 and when the statement where we put the breakpoint is reached, the IDE will stop for you to evaluate the variables at that point. Isn’t that neat? Once you hit F7, the program should continue without another stop at the breakpoint.

Eclipse - Debugging with conditional breakpoint

Compare this to not having a conditional breakpoint. You would have to step through 99 times before it reached your desired value of i and to finish debugging the program, you would have to hit F7 for another 900 times (or just stop debugging)!!

You are going to appreciate that IDEs provide this great feature.