Posts

Showing posts from February, 2012

How to set current jre version in windows environment

Image
You can set the current version of JRE in windows as given below. Open windows registry. (Run --> regedit) Go to HKEY_LOCAL_MACHINE -->SOFTWARE --> Javasoft --> Java Runtime Enviroment Edit and Change the Current Version in Java Runtime Environment

Java code compilation process

Image
When you compile a java file using javac compiler, it produces a file with .class extension. The class file consists of bytes code. Byte code is platform independent as it can be run on any platform once it is compiled.

Prevent Winmail.dat Attachments from Being Sent in Outlook

Select Tools | Options... from the menu. Go to the Mail Format tab. Under Compose in this message format: , make sure either HTML or Plain Text is selected. Click Internet Format . Make sure either Convert to Plain Text format or Convert to HTML format is selected under When sending Outlook Rich Text messages to Internet recipients, use this format: Click OK . Click OK again. 

Why Email attachments are downloaded as winmail.dat file ?

Transport-Neutral Encapsulation Format (TNEF) is Microsoft's non-standard format for encapsulating mail which has any non-plain-text content or properties (such as rich text, embedded OLE objects, voting buttons, and sometimes just attachments). Whether or not a given message is encoded using TNEF is determined by the Outlook default settings, per-recipient setting, Exchange Server settings, and message type and content. Once a TNEF message is used, the entire message, including all the original attachments and properties, is encapsulated in a single attachment of mime type "application/ms-tnef" added to the message to be sent over the Internet. This attachment is usually named "WINMAIL.DAT", and when sent to any non-MS mail client, is useless, and makes access to the original message attachments impossible. You can parse the winmail.dat file using the tnef.jar file in order to extract the attachments For more information please visit the belo...

Creating a Thread

Image
A Thread can be created in two ways. By Extending Thread class By Implementing Runnable interface Examples 1. Creating a Thread by extending Thread class class  MyThread  extends  Thread{   String s=null;    MyThread(String s1){    s=s1;    start();    }    public void  run(){    System.out.println(s);    } } public class  RunThread{    public static void  main(String args[]){         MyThread m1= new  MyThread( "Thread started...." );   } } 2. Creating a Thread by implementing Runnable interface class  MyThread1  implements  Runnable{    Thread t;   String s=null;    MyThread1(String s1){    s=s1;    t= new  Thread(this);    t.start();    }    public voi...

Scheduler example

Category.java package com.sandbox.scheduler.model; public enum Category {     RED(1),     GREEN(2),     BLUE(3);     private int value;     public int getValue() {         return value;     }     private Category(int value) {         this.value = value;     } } Task.java package com.sandbox.scheduler.model; import java.time.LocalDateTime; import java.util.UUID; import com.sandbox.scheduler.model.Category; public class Task {     public int urgency = -1;     public Category category;     public LocalDateTime timestamp = LocalDateTime.now();     public UUID uuid = UUID.randomUUID();     public Task(int urgency, Category category) {    ...