Index: applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java
===================================================================
--- applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java	(revision 33365)
+++ applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java	(revision 33372)
@@ -5,4 +5,5 @@
 
 import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
 import java.awt.Image;
 import java.awt.event.ActionEvent;
@@ -10,4 +11,5 @@
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
 
 import javax.media.jai.PlanarImage;
@@ -73,5 +75,8 @@
         this.imageFile = file;
         this.image = (BufferedImage) createImage();
-        layericon = new ImageIcon(ImportImagePlugin.pluginClassLoader.getResource("images/layericon.png"));
+        URL iconURL = ImportImagePlugin.pluginClassLoader.getResource("images/layericon.png");
+        if (iconURL != null) {
+            layericon = new ImageIcon(iconURL);
+        }
     }
 
@@ -96,17 +101,19 @@
         } catch (Exception e) {
             if (e.getMessage().contains("No projection file found")) {
-                ExtendedDialog ex = new ExtendedDialog(Main.parent, tr("Warning"), 
-                    new String[] {tr("Default image projection"), tr("JOSM''s current projection"), tr("Cancel")});
-                // CHECKSTYLE.OFF: LineLength
-                ex.setContent(tr("No projection file (.prj) found.<br>"
-                    + "You can choose the default image projection ({0}) or JOSM''s current editor projection ({1}) as original image projection.<br>"
-                    + "(It can be changed later from the right click menu of the image layer.)", 
-                    ImportImagePlugin.pluginProps.getProperty("default_crs_srid"), Main.getProjection().toCode()));
-                // CHECKSTYLE.ON: LineLength
-                ex.showDialog();
-                int val = ex.getValue();
-                if (val == 3) {
-                    logger.debug("No projection and user declined un-projected use");
-                    throw new LayerCreationCanceledException();
+                int val = 2;
+                if (!GraphicsEnvironment.isHeadless()) {
+                    ExtendedDialog ex = new ExtendedDialog(Main.parent, tr("Warning"), 
+                        new String[] {tr("Default image projection"), tr("JOSM''s current projection"), tr("Cancel")});
+                    // CHECKSTYLE.OFF: LineLength
+                    ex.setContent(tr("No projection file (.prj) found.<br>"
+                        + "You can choose the default image projection ({0}) or JOSM''s current editor projection ({1}) as original image projection.<br>"
+                        + "(It can be changed later from the right click menu of the image layer.)", 
+                        ImportImagePlugin.pluginProps.getProperty("default_crs_srid"), Main.getProjection().toCode()));
+                    // CHECKSTYLE.ON: LineLength
+                    val = ex.showDialog().getValue();
+                    if (val == 3) {
+                        logger.debug("No projection and user declined un-projected use");
+                        throw new LayerCreationCanceledException();
+                    }
                 }
                 CoordinateReferenceSystem src = null;
@@ -299,5 +306,5 @@
      *
      */
-    public class LayerPropertiesAction extends AbstractAction {
+    public static class LayerPropertiesAction extends AbstractAction {
         public ImageLayer imageLayer;
 
@@ -307,4 +314,5 @@
         }
 
+        @Override
         public void actionPerformed(ActionEvent arg0) {
             LayerPropertiesDialog layerProps = new LayerPropertiesDialog(imageLayer, PluginOperations.crsDescriptions);
@@ -317,5 +325,5 @@
      * Exception which represents that the layer creation has been canceled by the user.
      */
-    class LayerCreationCanceledException extends IOException{
+    static class LayerCreationCanceledException extends IOException{
     }
 
Index: applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java
===================================================================
--- applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java	(revision 33365)
+++ applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImportImagePlugin.java	(revision 33372)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
+import org.openstreetmap.josm.tools.JosmRuntimeException;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -37,6 +38,6 @@
     JosmAction loadFileAction = null;
 
-    // custom Classloader
-    static ClassLoader pluginClassLoader;
+    // custom Classloader to load resources from the main JAR
+    static ClassLoader pluginClassLoader = createPluginClassLoader();
 
     // plugin proerties
@@ -44,13 +45,9 @@
 
     // path constants
-    static final String PLUGIN_DIR = 
-            Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/";
-    static final String PLUGINPROPERTIES_PATH = 
-            Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/pluginProperties.properties";
-    static final String PLUGINLIBRARIES_DIR = 
-            Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/lib/";
+    static final String PLUGIN_DIR = Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/";
     static final String PLUGINPROPERTIES_FILENAME = "pluginProperties.properties";
-    static final String LOGGING_PROPERTIES_FILEPATH = 
-            Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin/log4j.properties/";
+    static final String PLUGINPROPERTIES_PATH = PLUGIN_DIR + PLUGINPROPERTIES_FILENAME;
+    static final String PLUGINLIBRARIES_DIR = PLUGIN_DIR + "lib/";
+    static final String LOGGING_PROPERTIES_FILEPATH = PLUGIN_DIR + "log4j.properties/";
 
     public Properties getPluginProps() {
@@ -67,7 +64,4 @@
 
         try {
-            // First create custom ClassLoader to load resources from the main JAR
-            pluginClassLoader = createPluginClassLoader();
-
             // Initialize logger
             initializeLogger(pluginClassLoader);
@@ -206,13 +200,13 @@
      * get a plugin-specific classloader.
      */
-    private ClassLoader createPluginClassLoader() throws MalformedURLException {
-        ClassLoader loader = null;
-        loader = URLClassLoader.newInstance(
-                new URL[] {new File(Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin.jar").toURI().toURL()},
-                ImportImagePlugin.class.getClassLoader()
-                );
-
-        return loader;
-    }
-
+    private static ClassLoader createPluginClassLoader() {
+        try {
+            return URLClassLoader.newInstance(
+                    new URL[] {new File(Main.pref.getPluginsDirectory().getAbsolutePath() + "/ImportImagePlugin.jar").toURI().toURL()},
+                    ImportImagePlugin.class.getClassLoader()
+                    );
+        } catch (MalformedURLException e) {
+            throw new JosmRuntimeException(e);
+        }
+    }
 }
Index: applications/editors/josm/plugins/ImportImagePlugin/test/data/regress/14894/14894.osm
===================================================================
--- applications/editors/josm/plugins/ImportImagePlugin/test/data/regress/14894/14894.osm	(revision 33372)
+++ applications/editors/josm/plugins/ImportImagePlugin/test/data/regress/14894/14894.osm	(revision 33372)
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <node id='-42868' action='modify' lat='43.31195000331' lon='3.4802979895' />
+  <node id='-42871' action='modify' lat='43.30296177662' lon='3.49264982466' />
+  <node id='-42872' action='modify' lat='43.31195000331' lon='3.49264982466' />
+  <node id='-42873' action='modify' lat='43.30296177662' lon='3.4802979895' />
+  <way id='-42874' action='modify'>
+    <nd ref='-42868' />
+    <nd ref='-42872' />
+    <nd ref='-42871' />
+    <nd ref='-42873' />
+    <nd ref='-42868' />
+  </way>
+</osm>
Index: applications/editors/josm/plugins/ImportImagePlugin/test/data/regress/14894/14894.wld
===================================================================
--- applications/editors/josm/plugins/ImportImagePlugin/test/data/regress/14894/14894.wld	(revision 33372)
+++ applications/editors/josm/plugins/ImportImagePlugin/test/data/regress/14894/14894.wld	(revision 33372)
@@ -0,0 +1,6 @@
+0.2750000000
+0.0000000000
+0.0000000000
+-0.2750000000
+387425.00000000
+5359575.00000000
Index: applications/editors/josm/plugins/ImportImagePlugin/test/unit/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayerTest.java
===================================================================
--- applications/editors/josm/plugins/ImportImagePlugin/test/unit/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayerTest.java	(revision 33372)
+++ applications/editors/josm/plugins/ImportImagePlugin/test/unit/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayerTest.java	(revision 33372)
@@ -0,0 +1,45 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins.ImportImagePlugin;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.io.OsmReader;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+
+/**
+ * Test that some geotiff sample files can be read.
+ * Data downloaded from <a href="ftp://ftp.remotesensing.org/pub/geotiff/samples">remotesensing.org</a>.
+ */
+public class ImageLayerTest {
+
+    /**
+     * Setup test.
+     */
+    @Rule
+    public JOSMTestRules rules = new JOSMTestRules().preferences().projection();
+
+    /**
+     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14894">#14894</a>
+     * @throws Exception if an error occurs during reading
+     */
+    @Test
+    public void testTicket14894() throws Exception {
+        assertTrue(Main.getLayerManager().getLayers().isEmpty());
+        // Step 1: add .osm layer
+        try (InputStream in = TestUtils.getRegressionDataStream(14894, "14894.osm")) {
+            Main.getLayerManager().addLayer(new OsmDataLayer(OsmReader.parseDataSet(in, null), "14894", null));
+        }
+        // Step 2: try to import image
+        Main.getLayerManager().addLayer(new ImageLayer(new File(TestUtils.getRegressionDataFile(14894, "14894.png"))));
+        assertEquals(2, Main.getLayerManager().getLayers().size());
+    }
+}
