Category Archives: java

java

How to write Java lambda Expression ?

Lambda expression is a new and important feature of Java which was included in Java SE 8. It provides a clear and concise way to represent one method interface using an expression. It is very useful in collection library. It … Continue reading

Posted in java, Uncategorized | Tagged , | Leave a comment

oracle.security.jps.service.idstore.IdentityStoreException: JPS-01520: Cannot initialize identity store at starting OBIEE

[bi_server1] [WARNING] [JPS-01520] [oracle.jps.idmgmt] [tid: [ACTIVE].ExecuteThread: ‘0’ for queue: ‘weblogic.kernel.Default (self-tuning)’] [userId: <WLS Kernel>] [ecid: 0000KdVfAivApIWFLzNM8A1K^prs000002,0] [APP: bicomposer#11.1.1] Cannot initialize identity store, cause: javax.naming.CommunicationException: 2001:0:9d38:90d7:280c:3b5:3f57:ebcd:9704 [Root exception is java.net.ConnectException: connect: Address is invalid on local machine, or port is not … Continue reading

Posted in ADF, OBIEE, Weblogic | Tagged | Leave a comment

run linux command from java and reading result?

import java.*; class Test { public static void main(String[] args) { int ch; try { Process myProcess = Runtime.getRuntime().exec(“ls -al”); InputStreamReader myIStreamReader = new InputStreamReader(myProcess.getInputStream()); while ((ch = myIStreamReader.read()) != -1) { System.out.print((char) ch); } } catch (IOException anIOException) { … Continue reading

Posted in java, mysql | Comments Off on run linux command from java and reading result?

Introduction to Web Services

Web services are distributed application components that are externally available. You can use them to integrate computer applications that are written in different languages and run on different platforms. Web services are language and platform independent because vendors have agreed … Continue reading

Posted in Web Services | Comments Off on Introduction to Web Services

String in java

Java Programming String is Special A Brief Summary of String Class A String contains a sequence of Unicode characters. Unlike C/C++, where string is simply an array of char, Java’s String is an object class in the core package java.lang. … Continue reading

Posted in java, Strings | Tagged | Comments Off on String in java

How to use ContextLoaderListener,how to make application Listener

publicclass Main extends org.springframework.web.context.ContextLoaderListener {  /** *@param args */ DatabaseListner listener = new DatabaseListner(); publicvoid contextDestroyed(ServletContextEvent event) { super.contextDestroyed(event); listener.end(); listener = null; System.out.println(“web app undeployed”); } publicvoid contextInitialized(ServletContextEvent event) { super.contextInitialized(event); new Thread(){ publicvoid run() { listener.listen(); } }.start(); … Continue reading

Posted in java | Tagged , | Comments Off on How to use ContextLoaderListener,how to make application Listener

move directory in Java ,convert file to linux,remove CRLF

privatevoid moveFilesFromSourceToDestination(String sourceFolder,String destinationFolder) throws IOException{log.info( “trying move “+sourceFolder+” to “+destinationFolder ); File sFolder = new File(sourceFolder); File dFolder = new File(destinationFolder); for (File file : sFolder.listFiles()){ if (file.isFile()){ File newFile = new File(dFolder.getAbsolutePath() + “/”+file.getName()); moveFile(file,newFile); }elseif (file.isDirectory()){ File … Continue reading

Posted in java | Tagged , , | Comments Off on move directory in Java ,convert file to linux,remove CRLF

how To sort a hashmap using its keys and/or values

To sort a hashmap using its keys :- Dump the HashMap into a TreeMap: Map yourMap= new HashMap(); // put some tuples in yourMap … Map sortedMap = new TreeMap(yourMap); To sort a hashmap using its values :- public HashMap getSortedMap(HashMap hmap) … Continue reading

Posted in collections | Comments Off on how To sort a hashmap using its keys and/or values

[Java] Reverse ordering a TreeMap

TreeMap is a Map that keep the element in the natural order of the key. The order can be changed providing to the contructor of the TreeMap a Comparable. So you can implement your custom one for more specific tasks. However if you only … Continue reading

Posted in collections | Comments Off on [Java] Reverse ordering a TreeMap

junit music box on eclipse

  http://www.brettdaniel.com/archives/2009/05/23/232945/

Posted in junit | Comments Off on junit music box on eclipse