--- a/src/src/com/umlet/control/Umlet.java
+++ b/src/src/com/umlet/control/Umlet.java
@@ -1,8 +1,11 @@
 // The UMLet source code is distributed under the terms of the GPL; see license.txt
 package com.umlet.control;
 
+//[BM-debianisation] for copy operation
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.net.URISyntaxException;
@@ -136,13 +139,62 @@
 	public static void main(String args[]) {
 
 		System.setSecurityManager(new CustomElementSecurityManager());
+
+		// [begin BM-debianisation] create directory $HOME/.umlet to store settings in
+		String bm_homeDirName = bm_getUmletUserDir();
+		// a list of directories to be created
+		List<String> bm_directories = new ArrayList();
+		bm_directories.add(bm_homeDirName);
+		bm_directories.add(bm_homeDirName + "custom_elements/");
+		bm_directories.add(bm_homeDirName + "custom_elements/tmp");
+		bm_directories.add(bm_homeDirName + "palettes/");
+		
+		
+		for (String bm_dirName : bm_directories) {
+			File bm_file = new File(bm_dirName);
+			if (!bm_file.isDirectory())
+			{
+				if ( ! bm_file.mkdir() )
+				{
+					System.err.println("Unable to create " + bm_dirName);
+					System.exit(-1);
+				}
+			}
+		}
+		
+      // copy all palette files to users umlet directory
+      // that's probably not the best way of fixing things, but it
+      // works an non-disruptive
+      // we cannot simply take the palettes directly from usr/... because
+      // we have no write rights there (for editing them), therefore it
+      // would be required to support multiple palette directories and
+      // do some other quirks
+      FileSystemView fileSystemView= FileSystemView.getFileSystemView();
+      File[] paletteFiles= fileSystemView.getFiles(new File("/usr/share/umlet/palettes/"), false);
+      List<File> palettes = new ArrayList<File>();
+      for(File palette : paletteFiles) {
+    	  if(palette.getName().endsWith(".uxf")) {
+				String targetName = bm_homeDirName + "palettes/" + palette.getName();
+				File outputFile = new File(targetName);
+				if (!outputFile.exists())
+					try {
+						bm_copy(palette, outputFile);
+					} catch (IOException e) {
+							System.err.println("Unable to copy palette file " + palette + " to " + targetName + "\nContinuing anyways.");
+					}
+    		}
+      }
+
+		// [end BM-debianisation]
+
 		Umlet umlet = Umlet.getInstance();
 
 		String tempPath, realPath;
 		tempPath = umlet.getProtectionDomainPath();
 		tempPath = tempPath.substring(0, tempPath.length() - 1);
 		tempPath = tempPath.substring(0, tempPath.lastIndexOf('/') + 1);
-		realPath = new File(tempPath).getAbsolutePath() + "/";
+		// BM fixed path
+		realPath = "/usr/share/umlet/";
 		umlet.setHomePath(realPath);
 
 		umlet.initLoggerConfiguration();
@@ -282,7 +334,9 @@
 	public List<File> scanForPalettes() {
 		// scan palettes directory...
 		FileSystemView fileSystemView = FileSystemView.getFileSystemView();
-		File[] paletteFiles = fileSystemView.getFiles(new File(this.getHomePath() + "palettes/"), false);
+		// BM-debianisation: Search in users palettes directory were we have copied 
+		// the palettes upon startup
+		File[] paletteFiles = fileSystemView.getFiles(new File(bm_getUmletUserDir() + "palettes/"), false);
 		List<File> palettes = new ArrayList<File>();
 		for (File palette : paletteFiles) {
 			if (palette.getName().endsWith(".uxf")) palettes.add(palette);
@@ -431,4 +485,22 @@
 			(new File(Umlet.getInstance().getTempPath() + umlet_file)).delete();
 		}
 	}
+
+	
+	// [BM-debianisation] file copy function
+	private static void bm_copy(File inputFile, File outputFile) throws IOException {
+		FileReader reader = new FileReader(inputFile);
+		FileWriter writer = new FileWriter(outputFile);
+		int character;
+		while ((character = reader.read()) != -1)
+			writer.write(character);
+	
+		reader.close();
+		writer.close();
+	}
+
+	public static String bm_getUmletUserDir() {
+		return System.getProperty("user.home")+"/.umlet/";
+	}
+
 }
--- a/src/src/com/umlet/custom/CustomElementCompiler.java
+++ b/src/src/com/umlet/custom/CustomElementCompiler.java
@@ -63,7 +63,8 @@
 		this.classname = "CustomElementImpl";
 		File tmpDir = new File(Umlet.getInstance().getHomePath() + Umlet.getCustomElementPath() + "tmp/");
 		tmpDir.mkdir();
-		this.sourcefile = new File(Umlet.getInstance().getHomePath() + Umlet.getCustomElementPath() + "tmp/" + this.classname + ".java");
+		// [BM-debianisation] use folder in the users home dir
+		this.sourcefile = new File(Umlet.bm_getUmletUserDir() + Umlet.getCustomElementPath() + "tmp/" + this.classname + ".java");
 	}
 
 	// compiles the element and returns the new entity if successful
--- a/src/src/com/umlet/custom/FileClassLoader.java
+++ b/src/src/com/umlet/custom/FileClassLoader.java
@@ -32,7 +32,8 @@
 	}
 
 	private byte[] loadClassData(String className) throws IOException {
-		File f = new File(Umlet.getInstance().getHomePath() + Umlet.getCustomElementPath() + "tmp/" + className + ".class");
+		// [BM-debianisation] use folder in the users home dir
+		File f = new File(Umlet.bm_getUmletUserDir() + Umlet.getCustomElementPath() + "tmp/" + className + ".class");
 		byte buff[] = new byte[(int) f.length()];
 		FileInputStream fis = new FileInputStream(f);
 		DataInputStream dis = new DataInputStream(fis);
--- a/src/src/com/umlet/control/Config.java
+++ b/src/src/com/umlet/control/Config.java
@@ -17,7 +17,7 @@
 
 	public static void loadConfig(String configfile) {
 		Config.configfile = configfile;
-		File umletcfg = new File(Umlet.getInstance().getHomePath() + configfile);
+		File umletcfg = new File(Umlet.bm_getUmletUserDir() + configfile);
 		if (umletcfg.exists()) {
 			try {
 				BufferedReader reader = new BufferedReader(new FileReader(umletcfg));
@@ -113,7 +113,7 @@
 		try {
 			if (configfile != null) // only save config after config has been loaded from somewhere
 			{
-				File umletcfg = new File(Umlet.getInstance().getHomePath() + configfile);
+				File umletcfg = new File(Umlet.bm_getUmletUserDir() + configfile);
 				umletcfg.delete();
 				umletcfg.createNewFile();
 				FileWriter writer = new FileWriter(umletcfg);
