From bffd3ca4333742dc549b9ff0921483c5f3266ed2 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 10 Mar 2010 12:48:35 +0000 Subject: [PATCH] warn if JAVA_HOME is not set --- tools/cooja/java/se/sics/cooja/GUI.java | 8 +++++++- .../java/se/sics/cooja/dialogs/ExternalToolsDialog.java | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index 430938913..80ad7170d 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/GUI.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: GUI.java,v 1.162 2010/03/09 08:27:48 fros4943 Exp $ + * $Id: GUI.java,v 1.163 2010/03/10 12:48:35 fros4943 Exp $ */ package se.sics.cooja; @@ -3082,6 +3082,12 @@ public class GUI extends Observable { /* Look and Feel: Nimbus */ setLookAndFeel(); + /* Warn at no JAVA_HOME */ + String javaHome = System.getenv().get("JAVA_HOME"); + if (javaHome == null || javaHome.equals("")) { + logger.warn("JAVA_HOME environment variable not set, Contiki motes (OS-level) may not compile"); + } + // Parse general command arguments for (String element : args) { if (element.startsWith("-contiki=")) { diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java index 9646b44ac..7e7256a45 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ExternalToolsDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ExternalToolsDialog.java,v 1.12 2008/11/04 15:01:08 adamdunkels Exp $ + * $Id: ExternalToolsDialog.java,v 1.13 2010/03/10 12:48:35 fros4943 Exp $ */ package se.sics.cooja.dialogs; @@ -140,10 +140,14 @@ public class ExternalToolsDialog extends JDialog { String javaHome = System.getenv().get("JAVA_HOME"); if (javaHome != null) { javaHome = javaHome.replace(File.separatorChar, '/'); + JLabel javaHomeLabel = new JLabel(" $(JAVA_HOME) maps to the environment Java home: " + javaHome); + explanations.add(javaHomeLabel); } else { javaHome = "[null]"; + JLabel javaHomeLabel = new JLabel(" $(JAVA_HOME) maps to the environment Java home: " + javaHome); + javaHomeLabel.setForeground(Color.RED); + explanations.add(javaHomeLabel); } - explanations.add(new JLabel(" $(JAVA_HOME) maps to the environment Java home: " + javaHome)); explanations.add(new JLabel(" $(LIBFILE) maps to the current library file being created (\"mtype1.library\")")); explanations.add(new JLabel(" $(MAPFILE) maps to the current map file being created (\"mtype1.map\")")); explanations.add(new JLabel(" $(ARFILE) maps to the current archive file being created (\"mtype1.a\")"));