Browse Source

Change the methods that try to locate JDK tools to work on AIX with

IBM's JDK 1.2 as well.

@todo refactor into a single method somewhere

PR: 5541


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270667 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
33bc8da118
3 changed files with 56 additions and 22 deletions
  1. +17
    -6
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  2. +21
    -11
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  3. +18
    -5
      src/main/org/apache/tools/ant/types/CommandlineJava.java

+ 17
- 6
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -680,14 +680,25 @@ public class Javac extends MatchingTask {
// nothing for *nix.
String extension = Os.isFamily("dos") ? ".exe" : "";

// Look for java in the java.home/../bin directory. Unfortunately
File jExecutable = null;

// On AIX using IBM's JDK 1.2 the javac executable is in
// the java.home/../../sh directory
if (Os.isName("aix")) {
jExecutable = new File(System.getProperty("java.home") +
"/../../sh/javac" + extension);
}

if (jExecutable == null || !jExecutable.exists()) {
// Look for javac in the java.home/../bin directory.
jExecutable = new File(System.getProperty("java.home") +
"/../bin/javac" + extension);
}

// Unfortunately
// on Windows java.home doesn't always refer to the correct location,
// so we need to fall back to assuming java is somewhere on the
// PATH.
java.io.File jExecutable =
new java.io.File(System.getProperty("java.home") +
"/../bin/javac" + extension );

if (jExecutable.exists() && !Os.isFamily("netware")) {
return jExecutable.getAbsolutePath();
} else {


+ 21
- 11
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1161,19 +1161,29 @@ public class Javadoc extends Task {
// nothing for *nix.
String extension = Os.isFamily("dos") ? ".exe" : "";

// Look for javadoc in the java.home/../bin directory. Unfortunately
// on Windows java.home doesn't always refer to the correct location,
// so we need to fall back to assuming javadoc is somewhere on the
File jdocExecutable = null;

// On AIX using IBM's JDK 1.2 the javadoc executable is in
// the java.home/../sh directory
if (Os.isName("aix")) {
jdocExecutable = new File(System.getProperty("java.home") +
"/../sh/javadoc" + extension);
}
if (jdocExecutable == null || !jdocExecutable.exists()) {
// Look for javadoc in the java.home/../bin directory.
jdocExecutable = new File(System.getProperty("java.home") +
"/../bin/javadoc" + extension);
}

// Unfortunately
// on Windows java.home doesn't always refer to the correct location,
// so we need to fall back to assuming java is somewhere on the
// PATH.
File jdocExecutable = new File( System.getProperty("java.home") +
"/../bin/javadoc" + extension );

if (jdocExecutable.exists() && !Os.isFamily("netware"))
{
if (jdocExecutable.exists() && !Os.isFamily("netware")) {
return jdocExecutable.getAbsolutePath();
}
else
{
} else {
if (!Os.isFamily("netware")) {
log( "Unable to locate " + jdocExecutable.getAbsolutePath() +
". Using \"javadoc\" instead.", Project.MSG_VERBOSE );


+ 18
- 5
src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,7 @@

package org.apache.tools.ant.types;

import java.io.File;
import java.util.Properties;
import java.util.Enumeration;
import java.util.Vector;
@@ -352,13 +353,25 @@ public class CommandlineJava implements Cloneable {
// nothing for *nix.
String extension = Os.isFamily("dos") ? ".exe" : "";

// Look for java in the java.home/../bin directory. Unfortunately
File jExecutable = null;

// On AIX using IBM's JDK 1.2 the java executable is in
// the java.home/../sh directory
if (Os.isName("aix")) {
jExecutable = new File(System.getProperty("java.home") +
"/../sh/java" + extension);
}
if (jExecutable == null || !jExecutable.exists()) {
// Look for java in the java.home/../bin directory.
jExecutable = new File(System.getProperty("java.home") +
"/../bin/java" + extension);
}

// Unfortunately
// on Windows java.home doesn't always refer to the correct location,
// so we need to fall back to assuming java is somewhere on the
// PATH.
java.io.File jExecutable =
new java.io.File(System.getProperty("java.home") +
"/../bin/java" + extension );

if (jExecutable.exists() && !Os.isFamily("netware")) {
// NetWare may have a "java" in that directory, but 99% of


Loading…
Cancel
Save