geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r545576 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/src/org/apache/geronimo/st/v20/core/GeronimoServer.java
Date Fri, 08 Jun 2007 18:06:20 GMT
Author: sppatel
Date: Fri Jun  8 11:06:19 2007
New Revision: 545576

URL: http://svn.apache.org/viewvc?view=rev&rev=545576
Log:
fix unable to start server due to invalid vmargs.. vm lib dir is different for mac.. platform
specific path seperator needed

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/src/org/apache/geronimo/st/v20/core/GeronimoServer.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/src/org/apache/geronimo/st/v20/core/GeronimoServer.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/src/org/apache/geronimo/st/v20/core/GeronimoServer.java?view=diff&rev=545576&r1=545575&r2=545576
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/src/org/apache/geronimo/st/v20/core/GeronimoServer.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v20.core/src/org/apache/geronimo/st/v20/core/GeronimoServer.java
Fri Jun  8 11:06:19 2007
@@ -28,6 +28,8 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.LibraryLocation;
 import org.eclipse.wst.server.core.IModule;
 import org.eclipse.wst.server.core.util.SocketUtil;
 
@@ -73,18 +75,32 @@
 		IVMInstall vmInstall = geronimoRuntimeDelegate.getVMInstall();
 		String vmInstallLocation = vmInstall.getInstallLocation().getAbsolutePath() + "/jre";
 		
-		// set -javaagent:"GERONIMO_BASE/bin/jpa.jar"
-		String javaagent = "-javaagent:\"" + runtimeLocation + "/bin/jpa.jar\"";
-		// set -Djava.ext.dirs="GERONIMO_BASE/lib/ext;JRE_HOME/lib/ext"
-		String javaExtDirs = "-Djava.ext.dirs=\"" + runtimeLocation + "/lib/ext;" + vmInstallLocation
+ "/lib/ext\"";
-		// -Djava.endorsed.dirs="GERONIMO_BASE/lib/endorsed;JRE_HOME/lib/endorsed"
-		String javaEndorsedDirs = "-Djava.endorsed.dirs=\"" + runtimeLocation + "/lib/endorsed;"
+ vmInstallLocation + "/lib/endorsed\"";
-		// -Dorg.apache.geronimo.base.dir="GERONIMO_BASE"
-		String baseDir = "-Dorg.apache.geronimo.base.dir=\"" + runtimeLocation + "\"";
-		// -Djava.io.tmpdir="var\temp"
-		String tmpDir = "-Djava.io.tmpdir=\"var/temp\"";
+		LibraryLocation[] libLocations = JavaRuntime.getLibraryLocations(vmInstall);
+		IPath vmLibDir = null;
+		for(int i = 0; i < libLocations.length; i++) {
+			LibraryLocation loc = libLocations[i];
+			IPath libDir = loc.getSystemLibraryPath().removeLastSegments(2);
+			if(libDir.toOSString().endsWith("lib")) {
+				vmLibDir = libDir;
+				break;
+			}
+		}
+		
+		String cp = System.getProperty("path.separator");
+		
+		//-javaagent:"GERONIMO_BASE/bin/jpa.jar"
+		String javaagent = "-javaagent:" + runtimeLocation + "/bin/jpa.jar";
+		
+		//-Djava.ext.dirs="GERONIMO_BASE/lib/ext;JRE_HOME/lib/ext"
+		String javaExtDirs = "-Djava.ext.dirs=" + runtimeLocation + "/lib/ext" + cp + vmLibDir.append("ext").toOSString();
+		
+		//-Djava.endorsed.dirs="GERONIMO_BASE/lib/endorsed;JRE_HOME/lib/endorsed"
+		String javaEndorsedDirs = "-Djava.endorsed.dirs=" + runtimeLocation + "/lib/endorsed" +
cp + vmLibDir.append("endorsed").toOSString();
+		
+		//-Dorg.apache.geronimo.base.dir="GERONIMO_BASE"
+		String baseDir = "-Dorg.apache.geronimo.base.dir=" + runtimeLocation;
 
-		String vmArgs = javaagent + " " + javaExtDirs + " " + javaEndorsedDirs + " " + baseDir
+ " " + tmpDir;
+		String vmArgs = javaagent + " " + javaExtDirs + " " + javaEndorsedDirs;
 
 		String superVMArgs = super.getVMArgs();
 		if (superVMArgs != null) {



Mime
View raw message