How to get current class name including package name in Java?

Use this.getClass().getCanonicalName() to get the full class name. Note that a package / class name (“a.b.C”) is different from the path of the .class files (a/b/C.class), and that using the package name / class name to derive a path is typically bad practice. Sets of class files / packages can be in multiple different class … Read more

javascript document.getElementsByClassName compatibility with IE

It’s not a method of document: function getElementsByClassName(node, classname) { var a = []; var re = new RegExp(‘(^| )’+classname+'( |$)’); var els = node.getElementsByTagName(“*”); for(var i=0,j=els.length; i<j; i++) if(re.test(els[i].className))a.push(els[i]); return a; } tabs = getElementsByClassName(document.body,’tab’); // no document

tech