Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-04-04 03:08:57 +0000
committerStephan Herrmann2010-04-04 03:08:57 +0000
commit3b9e4732666ba0f4f981298a6186aabf221b47bc (patch)
tree17e9e6de766f55578fb8af91fd621015d7e5efc3
parent1a7fc1281caddf0931d7b060f8511ff4783571ae (diff)
downloadorg.eclipse.objectteams-3b9e4732666ba0f4f981298a6186aabf221b47bc.tar.gz
org.eclipse.objectteams-3b9e4732666ba0f4f981298a6186aabf221b47bc.tar.xz
org.eclipse.objectteams-3b9e4732666ba0f4f981298a6186aabf221b47bc.zip
try to cope with different names of the JRE jar (needed for testing on IBM-Java)
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java
index 7ac155fde..fd579040d 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/compiler/org/eclipse/objectteams/otdt/tests/compiler/TestBase.java
@@ -67,11 +67,16 @@ public class TestBase extends TestCase
public static final String JAVA_HOME = System.getProperty("java.home");
public static final String USER_HOME = System.getProperty("user.home");
- public static final String JRE_JAR_PATH = JAVA_HOME
- + File.separator
- + "lib"
- + File.separator
- + "rt.jar";
+ public static final String JRE_JAR_PATH;
+ static {
+ String path = JAVA_HOME+File.separator+"lib"+File.separator+"rt.jar";
+ if ((new File(path).exists())) {
+ JRE_JAR_PATH = path;
+ } else {
+ JRE_JAR_PATH = JAVA_HOME+File.separator+"lib"+File.separator+"vm.jar";
+ System.err.println("TestBase: using alternate jre "+JRE_JAR_PATH);
+ }
+ }
public static final String OT_RUNTIME_PATH = JavaCore.getClasspathVariable(OTDTPlugin.OTRUNTIME_LIBDIR).toOSString();
@@ -149,9 +154,10 @@ public class TestBase extends TestCase
try
{
- if (!validClasspathEntries())
+ String missing;
+ if ((missing = missingClasspathEntry()) != null)
{
- throw new FileNotFoundException("Whether OTRE_JAR_PATH (otre.jar) or JRE_JAR_PATH (rt.jar) is unvalid.");
+ throw new FileNotFoundException("Missing library "+missing);
}
String[] args = (classpath == null)
@@ -192,12 +198,16 @@ public class TestBase extends TestCase
}
}
- private boolean validClasspathEntries()
+ private String missingClasspathEntry()
{
File otreJar = new File(OTRE_JAR_PATH);
File jreJar = new File(JRE_JAR_PATH);
- return (otreJar.exists() && jreJar.exists());
+ if (!otreJar.exists())
+ return OTRE_JAR_PATH;
+ if (!jreJar.exists())
+ return JRE_JAR_PATH;
+ return null;
}
public void createFile(String fname, String content)

Back to the top