<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Li Guoliang &#187; Java</title>
	<atom:link href="http://liguoliang.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://liguoliang.com</link>
	<description>ActionScript Flex Java JEE PHP...</description>
	<lastBuildDate>Mon, 21 May 2012 17:04:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using Inner class in Java</title>
		<link>http://liguoliang.com/2012/using-inner-class-in-java/</link>
		<comments>http://liguoliang.com/2012/using-inner-class-in-java/#comments</comments>
		<pubDate>Mon, 21 May 2012 17:03:23 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[InnerClass]]></category>
		<category><![CDATA[NestedClass]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2446</guid>
		<description><![CDATA[Here is the code:
package innerClasds.scjp.liguoliang.com;

import java.io.Serializable;

public class TestInnerClass {

	private String name = "var+T<p class='read-more'><a href='http://liguoliang.com/2012/using-inner-class-in-java/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Here is the code:</p>
<pre class="java" name="code">package innerClasds.scjp.liguoliang.com;

import java.io.Serializable;

public class TestInnerClass {

	private String name = "var+TestName";

	public static void main(String[] args) {
		new TestInnerClass().new InnerClass().printDes();
		new TestInnerClass().testInnerClassInMethod("info");
		TestInnerClass.StaticClass.printInfo();
	}

	/**
	 * 2. Inner class in method.
	 */
	void testInnerClassInMethod(final String info) {
		// In this class, we can get any variable in the outer class, but only can access the final variables in the method.
		// The reason is(from scjp book): can not keep variables(stored in stack) can keep as long as  inner class instance (stored in the heap),
		// so the inner class only access the final variable. 

		// and the class access modifier:  only abstract or final is permitted
		abstract class InnerClassInMethod {
			abstract void printInfo();
		}

		/** 3. Anonymous class;  */
		InnerClassInMethod inMethod = new InnerClassInMethod() {
			void printInfo() {
				System.out.println(InnerClassInMethod.class + TestInnerClass.this.name + "__" + info);
			}
		};

		inMethod.printInfo();
	}

	/**
	 * 1. Normal inner class. can use public, protected, (default), private accessor modifier to control the scope of the class.
	 * @author Li Guoliang
	 *
	 */
	private class InnerClass extends TestInnerClass implements Serializable{
		private static final long serialVersionUID = 1L;
		//always need final, otherwise:
		//  The field s cannot be declared static; static fields can only be declared in static or top level types
		public static final String s = "s";
		void printDes() {
			System.out.println("Inner" + s + " " + TestInnerClass.class);
		}
	}

	/**
	 * 4. Static nested class.
	 * @author Li Guoliang
	 *
	 */
	private static class StaticClass {
		static void printInfo() {
			System.out.println(StaticClass.class);
		}
	}

}
</pre>
<h4>Some comments:</h4>
<p>1. Inner Class: </p>
<p>can be public, protected, private, final, abstract, static, strictfp.<br />need an outer instance to crate the inner instance, like: new TestInnerClass().new InnerClass();<br />Use outClass.this to get the outer instance;</p>
<p>2. Inner class in method</p>
<p>can be public, protected, private, final, abstract, static, strictfp;<br />can access any property in the outer instance;<br />only can access final variable in the method.</p>
<p>3. Anonymous class</p>
<p>4. Static nested class<br />can be public, protected, private, final, abstract, static, strictfp.</p>
<p>here are some notes when I first learn inner class in java: <a href="http://liguoliang.com/2009/java%E5%86%85%E9%83%A8%E7%B1%BB%E4%BD%BF%E7%94%A8%E6%80%BB%E7%BB%93/" target="_blank">&gt;&gt;go&lt;&lt;</a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/using-inner-class-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java: Using Assertion in Eclipse</title>
		<link>http://liguoliang.com/2012/java-using-assertion-in-eclipse/</link>
		<comments>http://liguoliang.com/2012/java-using-assertion-in-eclipse/#comments</comments>
		<pubDate>Sun, 20 May 2012 16:06:17 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Assertion]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2443</guid>
		<description><![CDATA[Assertion: 
	public static void main(String[] args) {
		int x = 10;
		assert x==100:"assertion failed!";
	}

How to determine assertion is enabled or <p class='read-more'><a href='http://liguoliang.com/2012/java-using-assertion-in-eclipse/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Assertion: </p>
<pre class="java" name="code">	public static void main(String[] args) {
		int x = 10;
		assert x==100:"assertion failed!";
	}
</pre>
<p>How to determine assertion is enabled or not?</p>
<pre class="java" name="code">		   boolean isEnable=false;
		   assert isEnable = true;
		   if(isEnable){
		       throw new RuntimeException("Assertion shoule be enable!");
		   }
</pre>
<p>This is a bad assertion, because it change the value, If assertion is enabled, isEnable will be set to true. </p>
<h4>How to enable assertion in Eclipse? </h4>
<p>Debug/Run configurations &gt; VM arguments: add &#8220;-ea&#8221; to enable it or &#8220;-da&#8221; to disable assertion.</p>
<p>should not used for validate parameter in public method: because anyone can use public method, and can not make sure assertion is enabled or not;</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/java-using-assertion-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About Exceptions in Java</title>
		<link>http://liguoliang.com/2012/about-exceptions-in-java/</link>
		<comments>http://liguoliang.com/2012/about-exceptions-in-java/#comments</comments>
		<pubDate>Sun, 20 May 2012 09:22:27 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Java Exception]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2436</guid>
		<description><![CDATA[Exceptions in Java:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#038;nbs<p class='read-more'><a href='http://liguoliang.com/2012/about-exceptions-in-java/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Exceptions in Java:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Throwable<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exception</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RuntimeException …..&nbsp;&nbsp;&nbsp; </p>
<p>There are two types Exception:</p>
<p>1. Checked Exception , we need to declare ‘throws’ in mehtod if there maybe exception be&nbsp; thrown out, and must be catch or throw it if we use the method. <br />2. UnChecked exception(RuntimeExcepiton), will be thorwed in runtime, no need to declare them in the method. </p>
<p>1. UnChecked Exception:</p>
<pre class="java" name="code">public class TestException {
	public void test() throws NullPointerException{
		System.out.println("Test  OK");
	}

	public static void main(String[] args) {
		new TestException().test();
	}
}
</pre>
<p>output: &#8220;Test OK&#8221; </p>
<p>2. Checked Exception: </p>
<pre class="java" name="code">public class TestException {
	public void test() throws IOException{
		System.out.println("Test  OK");
	}

	public static void main(String[] args) {
		new TestException().test(); // Can not compile: surround with try/catch or add throws declaration
	}
}
</pre>
<p>3. Overriding: </p>
<p>Access modifier can be enlarged, but exception only can be less or specialized.
<pre class="java" name="code">package scjp.liguoliang.com;

import java.io.FileNotFoundException;
import java.io.IOException;

public class TestException {
	public void test() throws IOException{
		System.out.println();
	}

}

class TestExceptionSub extends TestException {
	public void test() throws FileNotFoundException{ // FileNotFoundException extends IOException

	}
}
</pre>
<p>This can work fine, but if we let TestExceptionSub to implement an Interface, like: </p>
<pre class="java" name="code">package scjp.liguoliang.com;

import java.sql.SQLException;

public interface ITestException {

	void test() throws  SQLException;
}
</pre>
<pre class="code" name="java">package scjp.liguoliang.com;

import java.io.FileNotFoundException;
import java.io.IOException;

public class TestException {
	public void test() throws IOException{
		System.out.println();
	}

}

class TestExceptionSub extends TestException implements ITestException{
	public void test() throws FileNotFoundException{ //Can not compile!

	}
}
</pre>
<p>Multiple markers at this line<br />&nbsp;&nbsp;&nbsp; &#8211; overrides scjp.liguoliang.com.TestException.test<br />&nbsp;&nbsp;&nbsp; &#8211; Exception FileNotFoundException is not compatible with throws clause in <br />&nbsp;&nbsp;&nbsp;&nbsp; ITestException.test()</p>
<p>&nbsp;</p>
<p>for test() in TestExceptionSub , If we want to throw any checked exception, we need get the sub class from &#8216;IOException&#8217; and &#8216;SQLException&#8217;., or just remove throws declaration. </p>
<p>but for un-checked exception, you can throw any, and no matter with the super class declaration.</p>
<p>4. Catch sequence: the specification exception need catched before it&#8217;s super exception, otherwise: <br />&#8220;Unreachable catch block for Exception. It is already handled by the catch block for Throwable&#8221;</p>
<pre class="code" name="java">
	public static void main(String[] args) {
		try{
			throw new SQLException();
		}catch (SQLException e) {
			System.out.println("SQLException catched!");
			return;
		}catch (Throwable e) {
			System.out.println("Exception Catched!");
			return;
		}
		finally {
			System.out.println("Finally");
		}
	}
</pre>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/about-exceptions-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overloading and overriding method call</title>
		<link>http://liguoliang.com/2012/overloading-and-overriding-method-call/</link>
		<comments>http://liguoliang.com/2012/overloading-and-overriding-method-call/#comments</comments>
		<pubDate>Tue, 15 May 2012 13:11:42 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[overload]]></category>
		<category><![CDATA[override]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2432</guid>
		<description><![CDATA[Overloading method will be determined by reference type, but override method will be determined by the actual object tyep.  property is determined by <p class='read-more'><a href='http://liguoliang.com/2012/overloading-and-overriding-method-call/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Overloading method will be determined by reference type, but override method will be determined by the actual object tyep. <br /> property is determined by reference type too. </p>
<pre class="code" name="java">
package newjob.guoliang.corejava;

public class ReferenceTypeTest {
	public static void main(String[] args) {
		AClass a = new BClass();
		new ReferenceTypeTest().printClassDesc(a);
	}

	protected void printClassDesc(AClass a) {
		System.out.println("A_" + a.desc);
	}

	protected void printClassDesc(BClass b) {
		System.out.println("B_" + b.desc);
	}

}

class AClass {
	String desc = "ClassA";
}

class BClass extends AClass{
	String desc = "ClassB";
}
</pre>
<p>Output is:</p>
<p><code>A_ClassA<br />
MethodClassB_ClassB<br /></code/></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/overloading-and-overriding-method-call/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java method invoked sequence</title>
		<link>http://liguoliang.com/2012/java-method-invoked-sequence/</link>
		<comments>http://liguoliang.com/2012/java-method-invoked-sequence/#comments</comments>
		<pubDate>Tue, 15 May 2012 12:51:07 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ClassLoad]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2430</guid>
		<description><![CDATA[Static block / variable;
Instance block / variable;
Constructor;
public class StaticTest {
	public static void main(String[] args) {
		// System.out.p<p class='read-more'><a href='http://liguoliang.com/2012/java-method-invoked-sequence/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Static block / variable;</p>
<p>Instance block / variable;</p>
<p>Constructor;</p>
<pre class="java" name="code">public class StaticTest {
	public static void main(String[] args) {
		// System.out.println(B.a);
		// System.out.println(C.c);
		StaticTest staticTest = new StaticTest();
		staticTest.printName();
	}

	static {
		System.out.println("Static_block_Main");
	}

	public StaticTest() {
		System.out.println("Consturctor_Main");
	}

	private void printName() {
		System.out.println("InstanceMethod");
	}
	{
		System.out.println("Instance_block_Main");
	}

}
</pre>
<p>Output is:</p>
<p><code>Static_block_Main<br />Instance_block_Main<br />Consturctor_Main<br />InstanceMethod</code></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/java-method-invoked-sequence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About Java static block</title>
		<link>http://liguoliang.com/2012/about-java-static-block/</link>
		<comments>http://liguoliang.com/2012/about-java-static-block/#comments</comments>
		<pubDate>Mon, 14 May 2012 16:06:35 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Static block]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2424</guid>
		<description><![CDATA[package scjp.liguoliang.com;

/**
 * I'm try to see the static block run rules,
 * B extends A, A has a static a, when we use B.a, class B did not loa<p class='read-more'><a href='http://liguoliang.com/2012/about-java-static-block/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<pre class="code" name="java">package scjp.liguoliang.com;

/**
 * I'm try to see the static block run rules,
 * B extends A, A has a static a, when we use B.a, class B did not loaed, just Class A loaded.
 * If B also has a static a, A and B will be loaded.
 * If a is finle, A and B will not be loaded both.
 * @author Li Guoliang
 *
 */
public class TestClassLoading {
	public static void main(String[] args) {
		System.out.println(B.a);
		System.out.println(C.c);
	}
}

class A {
	static String a = "A.a"; // how about if this is final
	static {
		System.out.println("Static_A_Class");
	}

	{
		System.out.println("Instance_A");
	}
}

class B extends A{
	// static String a = "B.a";
	static {
		System.out.println("Static_B_Class");
	}
}

/**
 * This class is designed for test the squence of static variable and block.
 * They run by the sequence of the code.
 * @author Li Guoliang
 *
 */
class C {

	static {
		System.out.println("Static_C");
	}
	static C c = new C();

	public C() {
		System.out.println("Constructor_C");
	}
}
</pre>
<p>Output</p>
<p><code></p>
<p>Static_A_Class<br />A.a<br />Static_C<br />Constructor_C<br />scjp.liguoliang.com.C@161f10f</p>
<p></code></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/about-java-static-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which method will be called? about Overriding and Overloading in Java</title>
		<link>http://liguoliang.com/2012/which-method-will-be-called-about-overriding-and-overloading-in-java/</link>
		<comments>http://liguoliang.com/2012/which-method-will-be-called-about-overriding-and-overloading-in-java/#comments</comments>
		<pubDate>Sun, 13 May 2012 07:02:08 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Overloading]]></category>
		<category><![CDATA[Overriding]]></category>
		<category><![CDATA[Polymorphism]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2421</guid>
		<description><![CDATA[Here are two class: Animal and Dog, Dog extends from Animal:
package scjp.liguoliang.com;

public class Animal {

	private String type = "Dog";
	publi<p class='read-more'><a href='http://liguoliang.com/2012/which-method-will-be-called-about-overriding-and-overloading-in-java/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Here are two class: Animal and Dog, Dog extends from Animal:</p>
<pre class="code" name="java">package scjp.liguoliang.com;

public class Animal {

	private String type = "Dog";
	public String name = "Animal";

	public String getType() {
		return type;
	}

	public void eat() {
		System.out.println(name + ", Animal eat...");
	}
}
</pre>
<pre class="code" name="java">package scjp.liguoliang.com;

public class Dog extends Animal {

	private String type = "Dog";
	public String name = "Dog";

	public String getType() {
		return type;
	}

	public void eat() {
		System.out.println(name + ", Dog eat...");
	}
}
</pre>
<p>And here is the test codes:</p>
<pre class="code" name="java">	public static void main(String[] args) {
		Dog dog = new Dog();
		Animal animalDog = new Dog(); // New dog, but type is Animal.

		System.out.println(dog.name);
		System.out.println(dog.getType());
		dog.eat();

		System.out.println(animalDog.name);
		System.out.println(animalDog.getType());
		animalDog.eat();

		System.out.println("\nWe are going to test overloading:");
		OverLoadingTest overLoadingTest = new OverLoadingTest();
		overLoadingTest.testEat(animalDog);
		overLoadingTest.testEat(dog);
	}

	public void testEat(Animal animal) {
		System.out.println("Test Animal eat");
	}

	public void testEat(Dog dog) {
		System.out.println("Test Dog eat");
	}
</pre>
<p>Here is the output: </p>
<p><code></p>
<p>Dog<br />Dog<br />Dog, Dog eat...<br />Animal // Get the property by reference Type, so print the name of ‘Animal’<br />Dog // Polymorphism, call the method of the instance in run time;<br />Dog, Dog eat...</p>
<p>We are going to test overloading:<br />Test Animal eat // Compiler will decide which method will be called by reference type when compiling.&nbsp; <br />Test Dog eat</p>
<p></code></p>
<p>In summary:</p>
<p>1. overriding: Polymorphism is for instance method, so&nbsp; an animal type reference to a dog Object will call dog’s method; but for properties, will use animals.</p>
<p>2. overloading: which method will be called has been determined when compiling by the reference type.</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/which-method-will-be-called-about-overriding-and-overloading-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debug remote JBoss application in Eclipse 在Eclipse中远程调试JBoss应用</title>
		<link>http://liguoliang.com/2012/debug-remote-jboss-application-in-eclipse/</link>
		<comments>http://liguoliang.com/2012/debug-remote-jboss-application-in-eclipse/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 14:50:34 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[JBoss]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2272</guid>
		<description><![CDATA[#1. Config JBoss configuration file：
jboss-5.1.0.GA\bin： modify the configuration run.conf.bat(Windows) or run.conf(Linux), remove the comment at the <p class='read-more'><a href='http://liguoliang.com/2012/debug-remote-jboss-application-in-eclipse/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>#1. Config JBoss configuration file：</p>
<p>jboss-5.1.0.GA\bin： modify the configuration run.conf.bat(Windows) or run.conf(Linux), remove the comment at the start of the line, and set suspend=n：</p>
<p>(remove: <strike>rem or #</strike> )set &#8220;JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n&#8221;&nbsp;
<p>Start the server;
<p>#2. Debug the project in Eclipse:
<p><a href="http://liguoliang.com/wp-content/uploads/2012/02/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2012/02/image_thumb2.png" width="640" height="590"></a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/debug-remote-jboss-application-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java 正则表达式替换小心: $ / 符号</title>
		<link>http://liguoliang.com/2011/java-regex-dollar-sign/</link>
		<comments>http://liguoliang.com/2011/java-regex-dollar-sign/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 06:34:46 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Matcher.quoteReplacement]]></category>
		<category><![CDATA[REGEX]]></category>
		<category><![CDATA[正则表达式]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2087</guid>
		<description><![CDATA[尝试使用正则表达式处理内容时, 需要小心替换字符串中是否包含:$ or /, 譬如:
Pattern pattern = Pattern.compile(&#8220;\\{C0\\}&#8221;);
Matcher matcher = pattern.matcher(&#8220;Price: <p class='read-more'><a href='http://liguoliang.com/2011/java-regex-dollar-sign/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>尝试使用正则表达式处理内容时, 需要小心替换字符串中是否包含:$ or /, 譬如:</p>
<p>Pattern pattern = Pattern.compile(&#8220;\\{C0\\}&#8221;);<br />
Matcher matcher = pattern.matcher(&#8220;Price: [{C0}].&#8221;);<br />
System.out.println(matcher.replaceAll(&#8220;€6.99&#8243;));<br />
System.out.println(matcher.replaceAll(&#8220;$6.99&#8243;));<br />
输出:<br />
Price: [€6.99].<br />
Exception in thread &#8220;main&#8221; java.lang.IndexOutOfBoundsException: No group 6<br />
at java.util.regex.Matcher.group(Unknown Source)<br />
at java.util.regex.Matcher.appendReplacement(Unknown Source)<br />
at java.util.regex.Matcher.replaceAll(Unknown Source)<br />
at TestExcel2Xml.main(TestExcel2Xml.java:10)</p>
<p>可见第一个replaceAll是正常工作的, 但第二个中的美元符号就出问题了.</p>
<p>Java API:<br />
Note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string. Dollar signs may be treated as references to captured subsequences as described above, and backslashes are used to escape literal characters in the replacement string.</p>
<p><strong>可以使用Matcher.quoteReplacement(String)对替换内容进行预先处理:</strong> (<a href="http://download.oracle.com/javase/1.5.0/docs/api/java/util/regex/Matcher.html#quoteReplacement%28java.lang.String%29">API</a>)<br />
Returns a literal replacement String for the specified String. This method produces a String that will work use as a literal replacement s in the appendReplacement method of the Matcher class. The String produced will match the sequence of characters in s treated as a literal sequence. Slashes (&#8216;\&#8217;) and dollar signs (&#8216;$&#8217;) will be given no special meaning.</p>
<p>修改为:</p>
<p>Pattern pattern = Pattern.compile(&#8220;\\{C0\\}&#8221;);<br />
Matcher matcher = pattern.matcher(&#8220;Price: [{C0}].&#8221;);<br />
System.out.println(matcher.replaceAll(&#8220;€6.99&#8243;));<br />
System.out.println(matcher.replaceAll(Matcher.quoteReplacement(&#8220;$6.99&#8243;)));</p>
<p>正确输出:</p>
<p>Price: [€6.99].<br />
Price: [$6.99].</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/java-regex-dollar-sign/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>基于Athena framework快速创建Java Flex应用入门教程</title>
		<link>http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-index/</link>
		<comments>http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-index/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 14:05:17 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Athena Framework]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[Flex企业级框架]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-index/</guid>
		<description><![CDATA[本教程简要介绍基于Athena框架的Flex应用开发. 假定你已具备基本的Flex + Java开发技能. 我们将使用Athena框架快速创建一个类似与Adobe Flex Test Drive的小应用(<a href="http://www.adobe.com/devnet/flex/testdrive.html" target="_blank">链接</a>), 该应用与Adobe Flex Test Drive的不同之处在于: Flex端采用了A<p class='read-more'><a href='http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-index/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>本教程简要介绍基于Athena框架的Flex应用开发. 假定你已具备基本的Flex + Java开发技能. 我们将使用Athena框架快速创建一个类似与Adobe Flex Test Drive的小应用(<a href="http://www.adobe.com/devnet/flex/testdrive.html" target="_blank">链接</a>), 该应用与Adobe Flex Test Drive的不同之处在于: Flex端采用了Athena Framework, 并基于Athena Framework增加了服务器端的支持. </p>
<p>由于时间有限, 本例仅展示环境配置,&nbsp; 基于Athena Console管理数据结构并自动生成Java, Flex代码,&nbsp; 通过简单编程实现基本功能. </p>
<p>所有的代码均可通过: <a title="http://code.google.com/p/athenahelloworld/" href="http://code.google.com/p/athenahelloworld/">http://code.google.com/p/athenahelloworld/</a> checkout(不含lib).</p>
<p>本文分三部分:</p>
<ol>
<li><a href="http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-1/">基于Athena框架的Flex入门教程(1) 环境配置</a>
<li><a href="http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-2/">基于Athena框架的Flex入门教程(2)配置Entity, 自动生成Java端, Flex端代码</a>
<li><a href="http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-3/">基于Athena框架的Flex入门教程(3) 编写Java Flex两端代码,运行程序</a></li>
</ol>
<p>下图为Athena framework官方提供的Test Drive最后效果图, 可进行Employ的CRUD, 并列出Department的所有employ.</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/04/image_thumb22.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image_thumb2" border="0" alt="image_thumb2" src="http://liguoliang.com/wp-content/uploads/2011/04/image_thumb2_thumb.png" width="628" height="499"></a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/get-start-with-ahtena-flex-framework-index/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

