Friday, 7 April 2017

Java basics


=====================printing system properties===================
package com.vht;

import java.util.Enumeration;
import java.util.Properties;

public class Test {


public static void main(String args[])
{
Properties p = System.getProperties();
Enumeration<Object> keys = p.keys();
while (keys.hasMoreElements()) {
   String key = (String)keys.nextElement();
   String value = (String)p.get(key);
   System.out.println(key + " ---> " + value);
}

}


}
=============================================================

public class Test {


public static void main(String args[])
{
String FILE_NAME="toolkit.properties";

String path="C:/Program Files/Java/jdk1.6.0_45/jre/bin/";

path = path + (!path.endsWith("/") ? "*" : "") + FILE_NAME;
{
System.out.println(path);
}


  }
}


=============================================================='

public class Test {


public static void main(String args[])
{
File file = null;


String path="E:/Luv.txt";

file = new File(path);

if(file == null || !file.exists())
{   System.out.println("file not present");
}
else System.out.println("file exist");

  }
}


==========================================================
public class Test {


public static void main(String args[])
{
String fileName="Luv.txt";


String path="E:/abc/Luv.txt";
     path=path.substring(0, path.indexOf("/" + fileName));

     System.out.println(path);
}
}
   //////   Output :   E:/abc

======================================================

public class Test {


public static void main(String args[])
{

String PROPERTY_FILE_NAME = "toolkit.properties";

 String path="/VirtualHold/toolkit.properties";
 
   path=path.substring(0, path.indexOf("/" + PROPERTY_FILE_NAME));
   System.out.println(path);
   path = path + (!path.endsWith("/") ? "/" : "") + PROPERTY_FILE_NAME;
   System.out.println(path);
   
   
}
}
   //////   /VirtualHold
////VirtualHold/toolkit.properties


==============================================================

public class Test {


public static void main(String args[])
{

String PROPERTY_FILE_NAME = "toolkit.properties";

 String path="/VirtualHold/toolkit.properties";
 String PROMPT_RECORDER_FILE_NAME = "promptrecorder.properties";
 
   path=path.substring(0, path.indexOf("/" + PROPERTY_FILE_NAME));
   System.out.println(path);
   path = path + (!path.endsWith("/") ? "/" : "") + PROMPT_RECORDER_FILE_NAME;
   System.out.println(path);
   
   
}
}
/VirtualHold
/VirtualHold/promptrecorder.properties

=====================================================================

INFO|2017/03/20|07:12:29|p=PlatformSupport_AVP|s=E09BFED3012E3C703AE51DE937F29344|e=0001> Action "Begin" Starting
Could not locate: org.apache.http.client.HttpClient while resolving com.openmethods.vht.toolkit.impl.VHTToolkitStub
INFO|2017/03/20|07:12:29|p=PlatformSupport_AVP|s=E09BFED3012E3C703AE51DE937F29344> Creating Toolkit Stub Version 5.0.0
INFO|2017/03/20|07:12:29|p=PlatformSupport_AVP|s=E09BFED3012E3C703AE51DE937F29344> Loading Configuration from: C:\VirtualHold\toolkit.properties
Adding external media server: http://10.10.1.153:8080/voices/
Setting external media server distribution method to failover
Setting external media server logging to first-failure
INFO|2017/03/20|07:12:29|p=PlatformSupport_AVP|s=E09BFED3012E3C703AE51DE937F29344> : C:\VirtualHold\toolkit.properties\promptrecorder.properties
ERROR|2017/03/20|07:12:29|p=PlatformSupport_AVP|s=E09BFED3012E3C703AE51DE937F29344> Could not locate configuration file at /VirtualHold/toolkit.properties
java.io.FileNotFoundException: \VirtualHold\toolkit.properties\promptrecorder.properties (The system cannot find the path specified)
======================================================================





No comments:

Post a Comment