bug fix if JAVA_HOME not set

This commit is contained in:
fros4943 2007-09-18 16:23:38 +00:00
parent 8323fdfa30
commit 23b9136e5e

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ContikiMoteTypeDialog.java,v 1.33 2007/09/05 14:00:59 fros4943 Exp $ * $Id: ContikiMoteTypeDialog.java,v 1.34 2007/09/18 16:23:38 fros4943 Exp $
*/ */
package se.sics.cooja.contikimote; package se.sics.cooja.contikimote;
@ -1462,9 +1462,13 @@ public class ContikiMoteTypeDialog extends JDialog {
link2 = link2.replace("$(ARFILE)", arFile.getPath().replace(File.separatorChar, '/')); link2 = link2.replace("$(ARFILE)", arFile.getPath().replace(File.separatorChar, '/'));
ccFlags = ccFlags.replace("$(DEPFILE)", arFile.getPath().replace(File.separatorChar, '/')); ccFlags = ccFlags.replace("$(DEPFILE)", arFile.getPath().replace(File.separatorChar, '/'));
link1 = link1.replace("$(JAVA_HOME)", System.getenv().get("JAVA_HOME")); String javaHome = System.getenv().get("JAVA_HOME");
link2 = link2.replace("$(JAVA_HOME)", System.getenv().get("JAVA_HOME")); if (javaHome == null) {
ccFlags = ccFlags.replace("$(JAVA_HOME)", System.getenv().get("JAVA_HOME")); javaHome = "";
}
link1 = link1.replace("$(JAVA_HOME)", javaHome);
link2 = link2.replace("$(JAVA_HOME)", javaHome);
ccFlags = ccFlags.replace("$(JAVA_HOME)", javaHome);
for (File sourceFile : sourceFiles) { for (File sourceFile : sourceFiles) {
if (sourceFile.isDirectory()) { if (sourceFile.isDirectory()) {
@ -1570,6 +1574,7 @@ public class ContikiMoteTypeDialog extends JDialog {
} }
} catch (Exception e) { } catch (Exception e) {
logger.fatal("Error while compiling library: " + e); logger.fatal("Error while compiling library: " + e);
e.printStackTrace();
return false; return false;
} }
return true; return true;