Use http://www.jarhoo.com/ 2 varargs? Starting from Java 1.5, java starts supporting something called varargs[S]. public String format(String pattern, Object... arguments) You can pass in either an array, or a series of Objects. A vararg can only be used at the end of the argument list. 3 foreach loop Iterator suites = something; for (Suit suit : suits) for (Rank rank : ranks) sortedDeck.add(new Card(suit, rank)); int sum(int[] a) { int result = 0; for (int i : a) result += i; return result; } 4 Why is my nohup not working with Java 1.4? Use "nohup java -Xrs your.java.program &", instead of "nohup java your.java.program&". 5 java.lang.IllegalStateException: No match found Use if(Matcher.matches()) before calling matcher.group(int i) 6 What's the difference between Matcher.match(str) and .find(str)? Match() only returns true if str exactly matches the whole pattern, while find() will return true if a substr of str matches pattern. 7 If I use static synchronized Foo.bar(), what object does it lock? Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Starting from Java 1.5, java starts supporting something called varargs[S].
public String format(String pattern, Object... arguments)
You can pass in either an array, or a series of Objects. A vararg can only be used at the end of the argument list. 3 foreach loop Iterator suites = something; for (Suit suit : suits) for (Rank rank : ranks) sortedDeck.add(new Card(suit, rank)); int sum(int[] a) { int result = 0; for (int i : a) result += i; return result; } 4 Why is my nohup not working with Java 1.4? Use "nohup java -Xrs your.java.program &", instead of "nohup java your.java.program&". 5 java.lang.IllegalStateException: No match found Use if(Matcher.matches()) before calling matcher.group(int i) 6 What's the difference between Matcher.match(str) and .find(str)? Match() only returns true if str exactly matches the whole pattern, while find() will return true if a substr of str matches pattern. 7 If I use static synchronized Foo.bar(), what object does it lock? Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Iterator suites = something; for (Suit suit : suits) for (Rank rank : ranks) sortedDeck.add(new Card(suit, rank)); int sum(int[] a) { int result = 0; for (int i : a) result += i; return result; }
int sum(int[] a) { int result = 0; for (int i : a) result += i; return result; }
4 Why is my nohup not working with Java 1.4? Use "nohup java -Xrs your.java.program &", instead of "nohup java your.java.program&". 5 java.lang.IllegalStateException: No match found Use if(Matcher.matches()) before calling matcher.group(int i) 6 What's the difference between Matcher.match(str) and .find(str)? Match() only returns true if str exactly matches the whole pattern, while find() will return true if a substr of str matches pattern. 7 If I use static synchronized Foo.bar(), what object does it lock? Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Use "nohup java -Xrs your.java.program &", instead of "nohup java your.java.program&". 5 java.lang.IllegalStateException: No match found Use if(Matcher.matches()) before calling matcher.group(int i) 6 What's the difference between Matcher.match(str) and .find(str)? Match() only returns true if str exactly matches the whole pattern, while find() will return true if a substr of str matches pattern. 7 If I use static synchronized Foo.bar(), what object does it lock? Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Use if(Matcher.matches()) before calling matcher.group(int i) 6 What's the difference between Matcher.match(str) and .find(str)? Match() only returns true if str exactly matches the whole pattern, while find() will return true if a substr of str matches pattern. 7 If I use static synchronized Foo.bar(), what object does it lock? Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Match() only returns true if str exactly matches the whole pattern, while find() will return true if a substr of str matches pattern. 7 If I use static synchronized Foo.bar(), what object does it lock? Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Usually synchronized methods lock object this and forms a queue. However, there is no such thing as this for a static method. In this case, the synchronized static method locks Foo.class. 8 Java Memory Model http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html 9 unable to find valid certification path to requested target javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find 10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target when trying to open an SSL connection to a host using JSSE
This is usually caused by a wrong certificate on the server side, to solve this problem, install that certificate: http://blogs.sun.com/andreas/entry/no_more_unable_to_find
10 What's the difference between Hashtable, HashMap, and HashSet order: HashSet is a set, it doesn't guarantee to return the same order or keys every time you try to get keys. The other two do maintain order. multithreading: Hashtable is syncronnized, the other two aren't. 11 How do I customize MANIFEST file in an ant jar task? use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html 12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
use manifest tags: http://ant.apache.org/manual/CoreTasks/property.html
12 How do I pass functions as parameters Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages). 13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Java doesn't allow that, but you could do it in the following two ways: (1) pass in class name and method names, and reconstruct via reflection, and (2) thru constructor, pass in an object which has the function defined with an implicit function name (the name you pass around in other languages).
13 Does Java support eval? Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS] 14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Perl has eval, python has exec and eval, does Java have something similar? No, you'll need to write your own parser, or use Java 1.6 scripting [MP] [JS]
14 Process from Runtime.exec() hangs? It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR] 15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
It could be that your system has limited IO buffer[JW]. The solution is to write a input stream gobbler that consumes output from your process from buffer[VR]
15 How do I initialize Hashtables in place? [ON] class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; } 16 Do not swallow InterruptedException Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
[ON]
class Example { public final static Map constants = new HashMap() { { put("1", "First"); put("2", "Second"); put("3", "Third"); } }; }
Swallowing InterruptedException while Thread.sleep()'ing makes your program a blocking app that doesn't respond to ^c events. IBM http://www.ibm.com/developerworks/java/library/j-jtp05236.html 17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
17 No enclosing instance of type is accessible If you enclosing class is not static, then you can't new A.B(). It has to be A a = new A(); A.B b = a.new B(); If you want to use new A.B(), make B a static enclosing class. 18 Java scope? private – accessible only within the class package-private (no modifier) – accessible to other classes in the same package protected – extends access to subclasses outside the package public – accessible by any class. 19 How do I batch initialize arrays? String[] s = new String[] {"aaa", "bbb", "ccc"}; 20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
If you enclosing class is not static, then you can't new A.B(). It has to be
A a = new A(); A.B b = a.new B();
String[] s = new String[] {"aaa", "bbb", "ccc"};
20 Inconsistent Hierarchy? Go up the inheritance chain, until you see a parent class or interface that's not defined. 21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Go up the inheritance chain, until you see a parent class or interface that's not defined.
21 The hierarchy of the type Foo is inconsistent Make sure the interface Foo implements or the class Foo inherits from, exists. 22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Make sure the interface Foo implements or the class Foo inherits from, exists.
22 No appenders could be found for logger, log4j:WARN Please initialize the log4j system properly. Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath. jar cvf log4j.properties.jar log4j.properties To see the current Java search path //Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); } Comments References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
Somehow your log4j.properties file is not in search path. If everything else fails, you could just jar up your properties file and put it in your classpath.
jar cvf log4j.properties.jar log4j.properties
To see the current Java search path
//Get the System Classloader ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader(); //Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs(); for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); }
//Get the URLs URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();
for(int i=0; i< urls.length; i++) { System.out.println(urls[i].getFile()); }
References[JS] http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/[JW] http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=2[MP] http://mindprod.com/jgloss/eval.html[ON] http://www.oreillynet.com/onjava/blog/2006/06/syntax_support_for_collections.html[S] http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html[VR] http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html