View | Details | Raw Unified | Return to bug 172820 | Differences between
and this patch

Collapse All | Expand All

(-)eut_old_eclipse172820/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-1 / +21 lines)
Lines 11-16 Link Here
11
package org.eclipse.jdt.core.tests.compiler.regression;
11
package org.eclipse.jdt.core.tests.compiler.regression;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.io.FilenameFilter;
14
import java.io.FileNotFoundException;
15
import java.io.FileNotFoundException;
15
import java.io.FileOutputStream;
16
import java.io.FileOutputStream;
16
import java.io.IOException;
17
import java.io.IOException;
Lines 43-53 Link Here
43
public static Test suite() {
44
public static Test suite() {
44
	return buildUniqueComplianceTestSuite(testClass(), COMPLIANCE_1_5);
45
	return buildUniqueComplianceTestSuite(testClass(), COMPLIANCE_1_5);
45
}
46
}
46
47
	private String getHYClasses() {
48
		String jre = System.getProperty("java.home");
49
		FilenameFilter jarFilter = new FilenameFilter() {
50
			public boolean accept(File dir, String name) {
51
				return (name.endsWith(".jar") && !name.endsWith("-src.jar"));
52
			}
53
		};
54
		String libraryClasses = "";
55
		String path_separator = System.getProperty("path.separator");
56
		String[] jars = new File(jre + "/lib/boot/").list(jarFilter);
57
		for (int i = 0; i < jars.length; i++) {
58
			libraryClasses = libraryClasses + jre + "/lib/boot/" + jars[i] + path_separator;
59
		}
60
		return libraryClasses;
61
	}
62
	
47
	private String getLibraryClasses() {
63
	private String getLibraryClasses() {
48
		if (Util.isMacOS()) {
64
		if (Util.isMacOS()) {
49
			return JRE_HOME_DIR + "/../Classes/classes.jar"; 
65
			return JRE_HOME_DIR + "/../Classes/classes.jar"; 
50
		}
66
		}
67
		final String vmName = System.getProperty("java.vm.name");
68
		if ("DRLVM".equals(vmName)) {
69
            return getHYClasses();
70
        }
51
		return JRE_HOME_DIR + "/lib/rt.jar";
71
		return JRE_HOME_DIR + "/lib/rt.jar";
52
	}
72
	}
53
	
73
	
(-)eut_old_eclipse172820/org/eclipse/jdt/core/tests/runtime/DRLVMLauncher.java (+146 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.runtime;
12
13
import java.io.File;
14
import java.util.Vector;
15
/**
16
 * This is a new vm launcher to support Apache Harmony 
17
 * (http://harmony.apache.org) settings
18
 */
19
public class DRLVMLauncher extends StandardVMLauncher {
20
/**
21
 * @see LocalVMLauncher#getCommandLine
22
 */
23
public String[] getCommandLine() {	
24
	Vector commandLine= new Vector();
25
	
26
	// VM binary
27
    String vmLocation = this.vmPath + 
28
        (this.vmPath.endsWith(File.separator) ? "" : File.separator) + 
29
        "bin" + 
30
        File.separator + 
31
        "javaw";
32
    final String osName = System.getProperty("os.name");
33
    if (osName.indexOf("win32") != -1) {
34
        vmLocation += ".exe";
35
    }
36
    if (!new File(vmLocation).exists()) {
37
        vmLocation = 
38
            this.vmPath + 
39
            (this.vmPath.endsWith(File.separator) ? "" : File.separator) + 
40
            "bin" + 
41
            File.separator + 
42
            "java";
43
    }
44
    commandLine.addElement(vmLocation);
45
	
46
	// VM arguments
47
	if (this.vmArguments != null) {
48
		for (int i = 0; i < this.vmArguments.length; i++) {
49
			commandLine.addElement(this.vmArguments[i]);
50
		}
51
	}
52
53
	// boot classpath
54
	commandLine.addElement("-Xbootclasspath/a:" + buildBootClassPath());
55
56
	// debug mode
57
	if (this.debugPort != -1) {
58
		commandLine.addElement("-Xdebug");
59
		commandLine.addElement("-Xnoagent");
60
		// commandLine.addElement("-Djava.compiler=NONE");
61
		commandLine.addElement(
62
			"-Xrunjdwp:transport=dt_socket,address=" +
63
			this.debugPort +
64
			",server=y,suspend=n");
65
	}
66
	
67
	// regular classpath
68
	commandLine.addElement("-classpath");
69
	commandLine.addElement(buildClassPath());
70
71
	// code snippet runner class
72
	if (this.evalPort != -1) {
73
		commandLine.addElement(CODE_SNIPPET_RUNNER_CLASS_NAME);
74
	}
75
	
76
	// code snippet runner arguments
77
	if (this.evalPort != -1) {
78
		commandLine.addElement(EVALPORT_ARG);
79
		commandLine.addElement(Integer.toString(this.evalPort));
80
		if (TARGET_HAS_FILE_SYSTEM) {
81
			commandLine.addElement(CODESNIPPET_CLASSPATH_ARG);
82
			commandLine.addElement(this.evalTargetPath + File.separator + REGULAR_CLASSPATH_DIRECTORY);
83
			commandLine.addElement(CODESNIPPET_BOOTPATH_ARG);
84
			commandLine.addElement(this.evalTargetPath + File.separator + BOOT_CLASSPATH_DIRECTORY);
85
		}
86
	}
87
88
	// program class
89
	if (this.programClass != null) {
90
		commandLine.addElement(this.programClass);
91
	}
92
	
93
	// program arguments
94
	if (this.programArguments != null) {
95
		for (int i=0;i<this.programArguments.length;i++) {
96
			commandLine.addElement(this.programArguments[i]);
97
		}
98
	}
99
100
	String[] result;
101
	if (this.batchFileName!= null) {
102
		// Write to batch file if specified
103
		writeBatchFile(this.batchFileName, commandLine);
104
		result = new String[] {this.batchFileName};
105
	} else {
106
		result = new String[commandLine.size()];
107
		commandLine.copyInto(result);
108
	}
109
110
	// check for spaces in result
111
	for (int i = 0; i < result.length; i++) {
112
		String argument = result[i];
113
		if (argument.indexOf(' ') != -1) {
114
			result[i] = "\"" + argument + "\"";
115
		}
116
	}
117
	
118
	return result;
119
}
120
121
/**
122
 * Builds the actual boot class path that is going to be passed to the VM.
123
 */
124
protected String buildBootClassPath() {
125
	StringBuffer bootPathString = new StringBuffer();
126
	char pathSeparator = File.pathSeparatorChar;
127
	
128
	if (this.bootPath != null) {
129
		// Add boot class path given by client
130
		int length = this.bootPath.length;
131
		for (int i = 0; i < length; i++){
132
			bootPathString.append(this.bootPath[i]);
133
			bootPathString.append(pathSeparator);
134
		}
135
	}
136
		
137
	// Add boot class path directory if needed
138
	if (this.evalTargetPath != null && TARGET_HAS_FILE_SYSTEM) {
139
		bootPathString.append(this.evalTargetPath);
140
		bootPathString.append(File.separatorChar);
141
		bootPathString.append(BOOT_CLASSPATH_DIRECTORY);
142
	}
143
144
	return bootPathString.toString();
145
}
146
}
(-)eut_old_eclipse172820/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java (+4 lines)
Lines 66-71 Link Here
66
	if ("IBM J9SE VM".equals(vmName)) {
66
	if ("IBM J9SE VM".equals(vmName)) {
67
		return new SideCarJ9VMLauncher();
67
		return new SideCarJ9VMLauncher();
68
	}
68
	}
69
	//	DRLVM works ok when launching in the same way as SideCarVM
70
    if ("DRLVM".equals(vmName)) {
71
        return new DRLVMLauncher();
72
    }
69
	return new SideCarVMLauncher();
73
	return new SideCarVMLauncher();
70
}
74
}
71
/**
75
/**
(-)eut_old_eclipse172820/org/eclipse/jdt/core/tests/util/Util.java (+13 lines)
Lines 12-17 Link Here
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.io.FileInputStream;
14
import java.io.FileInputStream;
15
import java.io.FilenameFilter;
15
import java.io.FileNotFoundException;
16
import java.io.FileNotFoundException;
16
import java.io.FileOutputStream;
17
import java.io.FileOutputStream;
17
import java.io.IOException;
18
import java.io.IOException;
Lines 505-510 Link Here
505
			toNativePath(jreDir + "/lib/rt.jar")
506
			toNativePath(jreDir + "/lib/rt.jar")
506
		};				
507
		};				
507
	}
508
	}
509
	if ("DRLVM".equals(vmName)) {
510
        FilenameFilter jarFilter = new FilenameFilter() {
511
                public boolean accept(File dir, String name) {
512
                        return name.endsWith(".jar") & !name.endsWith("-src.jar");
513
                }
514
        };
515
        String[] jars = new File(jreDir + "/lib/boot/").list(jarFilter);
516
        for (int i = 0; i < jars.length; i++) {
517
                jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]);
518
        }
519
        return jars;
520
    }
508
	return new String[] { 
521
	return new String[] { 
509
		toNativePath(jreDir + "/lib/core.jar"),
522
		toNativePath(jreDir + "/lib/core.jar"),
510
		toNativePath(jreDir + "/lib/security.jar"),
523
		toNativePath(jreDir + "/lib/security.jar"),

Return to bug 172820