Index: src/java/org/jivesoftware/Spark.java
===================================================================
--- src/java/org/jivesoftware/Spark.java	(revision 10982)
+++ src/java/org/jivesoftware/Spark.java	(working copy)
@@ -10,8 +10,18 @@
 
 package org.jivesoftware;
 
-import de.javasoft.plaf.synthetica.SyntheticaBlueMoonLookAndFeel;
-import de.javasoft.plaf.synthetica.SyntheticaLookAndFeel;
+import java.awt.Color;
+import java.awt.Font;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+
+import javax.swing.BorderFactory;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
 import org.jivesoftware.resource.Default;
 import org.jivesoftware.spark.util.ModelUtil;
 import org.jivesoftware.spark.util.log.Log;
@@ -18,11 +28,8 @@
 import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
 import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
 
-import javax.swing.*;
-import java.awt.*;
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
+import de.javasoft.plaf.synthetica.SyntheticaBlueMoonLookAndFeel;
+import de.javasoft.plaf.synthetica.SyntheticaLookAndFeel;
 
 /**
  * In many cases, you will need to know the structure of the Spark installation, such as the directory structures, what
@@ -40,6 +47,9 @@
     private static File RESOURCE_DIRECTORY;
     private static File BIN_DIRECTORY;
     private static File LOG_DIRECTORY;
+    private static File USER_DIRECTORY;
+    private static File PLUGIN_DIRECTORY;
+    private static File XTRA_DIRECTORY;
 
 
     /**
@@ -61,16 +71,45 @@
         StringBuffer buf = new StringBuffer();
         buf.append(current);
         buf.append(";");
+        
+        RESOURCE_DIRECTORY = new File(USER_SPARK_HOME, "/resources").getAbsoluteFile();
+        if(!RESOURCE_DIRECTORY.exists()){
+        	
+        	RESOURCE_DIRECTORY.mkdirs();
+        }
+        BIN_DIRECTORY = new File(USER_SPARK_HOME, "/bin").getAbsoluteFile();
+        if(!BIN_DIRECTORY.exists()){
+        	
+        	BIN_DIRECTORY.mkdirs();
+        }
+        LOG_DIRECTORY = new File(USER_SPARK_HOME, "/logs").getAbsoluteFile();
+        if (!LOG_DIRECTORY.exists()){
+        	
+        	LOG_DIRECTORY.mkdirs();
+        }
+        USER_DIRECTORY = new File(USER_SPARK_HOME, "/user").getAbsoluteFile();
+        if(!USER_DIRECTORY.exists()){
+        	
+        	USER_DIRECTORY.mkdirs();
+        }
+        PLUGIN_DIRECTORY = new File(USER_SPARK_HOME, "/plugins").getAbsoluteFile();
+        if(!PLUGIN_DIRECTORY.exists()){
+        	
+        	PLUGIN_DIRECTORY.mkdirs();
+        }
+        XTRA_DIRECTORY = new File(USER_SPARK_HOME, "/xtra").getAbsoluteFile();
+        if(!XTRA_DIRECTORY.exists()){
+        	
+        	XTRA_DIRECTORY.mkdirs();
+        	//TODO methode an richtige stelle setzen
+        	//copyEmoticonFiles();
 
+        }
 
         final String workingDirectory = System.getProperty("appdir");
         if (workingDirectory == null) {
-            RESOURCE_DIRECTORY = new File(USER_SPARK_HOME, "/resources").getAbsoluteFile();
-            BIN_DIRECTORY = new File(USER_SPARK_HOME, "/bin").getAbsoluteFile();
-            LOG_DIRECTORY = new File(USER_SPARK_HOME, "/logs").getAbsoluteFile();
-            RESOURCE_DIRECTORY.mkdirs();
-            LOG_DIRECTORY.mkdirs();
-            if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) {
+            
+            if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists() || !USER_DIRECTORY.exists() || !PLUGIN_DIRECTORY.exists() || !XTRA_DIRECTORY.exists()) {
                 JOptionPane.showMessageDialog(new JFrame(), "Unable to create directories necessary for runtime.", "Spark Error", JOptionPane.ERROR_MESSAGE);
                 System.exit(1);
             }
@@ -83,8 +122,12 @@
 
             RESOURCE_DIRECTORY = new File(workingDir, "resources").getAbsoluteFile();
             BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile();
-
-
+            File emoticons = new File(XTRA_DIRECTORY, "emoticons").getAbsoluteFile();
+            if(!emoticons.exists()){
+            	
+            	//Copy emoticon files from install directory to the spark user home directory
+            }
+            
             LOG_DIRECTORY = new File(USER_SPARK_HOME, "/logs").getAbsoluteFile();
             LOG_DIRECTORY.mkdirs();
             try {
@@ -378,4 +421,22 @@
             }
         }
     }
+   /* public void copyEmoticonFiles() {
+        // Current Plugin directory
+        File newEmoticonDir = new File(Spark.getLogDirectory().getParentFile(), "xtra/emoticons").getAbsoluteFile();
+        newEmoticonDir.mkdirs();
+        //TODO emoticondirectory anpassen
+        File EMOTICON_DIRECTORY = new File("D:/workspace/Spark 2.6 beta/src","xtra/emoticons");
+        File[] files = EMOTICON_DIRECTORY.listFiles();
+        
+        
+        for (File file : files) {
+            if (file.isFile()) {
+                
+               // Copy over
+               File newFile = new File(newEmoticonDir, file.getName());
+                
+            }
+        }
+    }*/
 }
Index: src/java/org/jivesoftware/spark/ui/ChatArea.java
===================================================================
--- src/java/org/jivesoftware/spark/ui/ChatArea.java	(revision 10982)
+++ src/java/org/jivesoftware/spark/ui/ChatArea.java	(working copy)
@@ -19,6 +19,7 @@
 import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.StringTokenizer;
 
@@ -95,6 +96,8 @@
     private EmoticonManager emoticonManager;
 
     protected Boolean forceEmoticons = false;
+    
+    private Boolean emoticonsAvailable = true;
 
     /**
      * ChatArea Constructor.
@@ -101,6 +104,14 @@
      */
     public ChatArea() {
         emoticonManager = EmoticonManager.getInstance();
+        
+        Collection emoticonPacks = null; 
+        emoticonPacks = emoticonManager.getEmoticonPacks();
+        
+        if(emoticonPacks == null){
+        	
+        	emoticonsAvailable = false;
+        }
 
         // Set Default Font
         final LocalPreferences pref = SettingsManager.getLocalPreferences();
@@ -310,7 +321,8 @@
      * @return true if the image was found, otherwise false.
      */
     public boolean insertImage(String imageKey) {
-        if(!forceEmoticons && !SettingsManager.getLocalPreferences().areEmoticonsEnabled()){
+    	
+        if(!forceEmoticons && !SettingsManager.getLocalPreferences().areEmoticonsEnabled() || !emoticonsAvailable){
             return false;
         }
         final Document doc = getDocument();
Index: src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java
===================================================================
--- src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java	(revision 10982)
+++ src/java/org/jivesoftware/spark/ui/themes/ThemePreference.java	(working copy)
@@ -84,7 +84,10 @@
         final String pack = panel.getSelectedEmoticonPack();
         boolean emotEnabled = panel.areEmoticonsEnabled();
         LocalPreferences pref = SettingsManager.getLocalPreferences();
-        pref.setEmoticonPack(pack);
+        if(pack != null){
+        	
+            pref.setEmoticonPack(pack);
+            }
         pref.setEmoticonsEnabled(emotEnabled);
         pref.setUseSystemLookAndFeel(panel.useSystemLookAndFeel());
         pref.setAvatarVisible(panel.areAvatarsVisible());
Index: src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonPlugin.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonPlugin.java	(revision 10982)
+++ src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonPlugin.java	(working copy)
@@ -30,6 +30,7 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.net.URL;
+import java.util.Collection;
 
 /**
  * Adds an EmoticonPickList to each ChatRoom.
@@ -63,13 +64,24 @@
         }
 
         final String activeEmoticonSetName = emoticonManager.getActiveEmoticonSetName();
+        
+        emoticonManager = EmoticonManager.getInstance();
+        Collection emoticonPacks = null; 
+        emoticonPacks = emoticonManager.getEmoticonPacks();
+        
+        if(emoticonPacks != null){
 
-        final Emoticon smileEmoticon = emoticonManager.getEmoticon(activeEmoticonSetName, ":)");
-        URL smileURL = emoticonManager.getEmoticonURL(smileEmoticon);
 
         // Add Emoticon button
-        ImageIcon icon = new ImageIcon(smileURL);
-        final RolloverButton emoticonPicker = new RolloverButton(icon);
+    	ImageIcon icon = null;
+        final RolloverButton emoticonPicker;
+        icon = new ImageIcon(getClass().getClassLoader().getResource("images/smileBtn.png"));
+        
+        if(icon == null){
+        	emoticonPicker = new RolloverButton("Smiley's",icon);
+        	
+        }else {emoticonPicker = new RolloverButton(icon);}
+            
         room.getEditorBar().add(emoticonPicker);
 
         emoticonPicker.addMouseListener(new MouseAdapter() {
@@ -109,6 +121,7 @@
                 room.getEditorBar().remove(emoticonPicker);
             }
         });
+       }
     }
 
     public void chatRoomLeft(ChatRoom room) {
Index: src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonUI.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonUI.java	(revision 10982)
+++ src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonUI.java	(working copy)
@@ -32,33 +32,37 @@
 
 
         Collection<Emoticon> emoticons = manager.getActiveEmoticonSet();
+        
 
-        int no = emoticons.size();
+        if(emoticons != null){
+            
+        	int no = emoticons.size();
 
-        int rows = no / 5;
+        	int rows = no / 5;
 
-        setLayout(new GridLayout(rows, 5));
+        	setLayout(new GridLayout(rows, 5));
 
-        // Add Emoticons
-        for (Emoticon emoticon : emoticons) {
-            final String text = emoticon.getEquivalants().get(0);
-            String name = manager.getActiveEmoticonSetName();
+        	// Add Emoticons
+        	for (Emoticon emoticon : emoticons) {
+        		final String text = emoticon.getEquivalants().get(0);
+        		String name = manager.getActiveEmoticonSetName();
 
-            final Emoticon smileEmoticon = manager.getEmoticon(name, text);
-            URL smileURL = manager.getEmoticonURL(smileEmoticon);
+        		final Emoticon smileEmoticon = manager.getEmoticon(name, text);
+        		URL smileURL = manager.getEmoticonURL(smileEmoticon);
 
-            // Add Emoticon button
-            ImageIcon icon = new ImageIcon(smileURL);
+        		// Add Emoticon button
+        		ImageIcon icon = new ImageIcon(smileURL);
 
-            RolloverButton emotButton = new RolloverButton();
-            emotButton.setIcon(icon);
-            emotButton.addActionListener(new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    listener.emoticonPicked(text);
-                }
-            });
-            add(emotButton);
-        }
+        		RolloverButton emotButton = new RolloverButton();
+        		emotButton.setIcon(icon);
+        		emotButton.addActionListener(new ActionListener() {
+        			public void actionPerformed(ActionEvent e) {
+        				listener.emoticonPicked(text);
+        			}
+        		});
+        		add(emotButton);
+        	}
+        }  
     }
 
     public void setEmoticonPickListener(EmoticonPickListener listener) {
Index: src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonManager.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonManager.java	(revision 10982)
+++ src/java/org/jivesoftware/sparkimpl/plugin/emoticons/EmoticonManager.java	(working copy)
@@ -87,18 +87,24 @@
      */
     private EmoticonManager() {
         EMOTICON_DIRECTORY = new File(Spark.getBinDirectory().getParent(), "xtra/emoticons").getAbsoluteFile();
-
-        // Copy over to allow for non-admins to extract.
-        copyFiles();
+        
+        File[] files = null; 
+        files = EMOTICON_DIRECTORY.listFiles();
+        
+        //If files in this directory, copy this files into the Spark User Home Directory
+        if(files != null){
+        	// Copy over to allow for non-admins to extract.
+        	copyFiles();
 
-        final LocalPreferences pref = SettingsManager.getLocalPreferences();
-        String emoticonPack = pref.getEmoticonPack();
+        	final LocalPreferences pref = SettingsManager.getLocalPreferences();
+        	String emoticonPack = pref.getEmoticonPack();
 
-        try {
-            addEmoticonPack(emoticonPack);
-        }
-        catch (Exception e) {
-            Log.error(e);
+        	try {
+        		addEmoticonPack(emoticonPack);
+        	}
+        	catch (Exception e) {
+            	Log.error(e);
+        	}
         }
     }
 
@@ -155,8 +161,15 @@
      */
     public Collection<Emoticon> getActiveEmoticonSet() {
         final LocalPreferences pref = SettingsManager.getLocalPreferences();
-        String emoticonPack = pref.getEmoticonPack();
-        return emoticonMap.get(emoticonPack);
+        String emoticonPack = null;
+        emoticonPack = pref.getEmoticonPack();
+        //If EmoticonPack is set
+        if(emoticonPack != null){
+        	
+        	return emoticonMap.get(emoticonPack);
+        }
+        
+        return null;
     }
 
     /**
@@ -379,8 +392,15 @@
      */
     public Collection<String> getEmoticonPacks() {
         final List<String> emoticonList = new ArrayList<String>();
-
+        
         File[] dirs = EMOTICON_DIRECTORY.listFiles();
+        
+        //If no emoticons are available
+          if(dirs == null){
+          	
+          	return null;
+          }
+          
         for (File file : dirs) {
             if (file.isDirectory() && file.getName().toLowerCase().endsWith("adiumemoticonset")) {
                 try {