Merge "Added JMXPort to VM Start arguments"
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
index 90786aa..314179d 100644
--- a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
@@ -112,8 +112,7 @@
 		return null;
 	}
 
-	public String[] getFrameworkVMArguments(IPath installPath,String javaProfileID,
-			IPath configPath, IPath deployPath, boolean isTestEnv) {
+	public String[] getFrameworkVMArguments(IPath installPath, int jmxPort, String javaProfileID, IPath configPath, IPath deployPath, boolean isTestEnv) {
 		
 		//String configPathStr = deployPath.makeAbsolute().toOSString();
 		String profilePath =  deployPath.append("java.profile").toOSString();
@@ -143,7 +142,8 @@
 		if(javaProfileID != null && !javaProfileID.equals(IOSGIExecutionEnvironment.Default.toString()))
 			vmArgs += "-Dosgi.java.profile=file:"+profilePath; //$NON-NLS-1$ //$NON-NLS-2$
 
-		return new String[] {"-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
+		 
+		return new String[] {"-Dcom.sun.management.jmxremote.port="+jmxPort, "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", "-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
 	}
 
 	public IStatus canAddModule(IModule module) {
@@ -298,13 +298,18 @@
 						IProject pluginProject = iPluginModelBase.getUnderlyingResource().getProject();
 						IJavaProject javaProject = JavaCore.create(pluginProject);
 						IBundleProjectDescription bundleProjectDescription = FrameworkCorePlugin.getDescription(pluginProject);
-
+						IPath bpath = new Path(iPluginModelBase.getInstallLocation());
+						IPath ploc  = pluginProject.getLocation();
+						if(bpath.equals(ploc))
+							bpath = pluginProject.getFullPath();
+						else
+							bpath = bpath.makeRelativeTo(ploc.removeLastSegments(1));
 						IBundleClasspathEntry[] allCPEntry = bundleProjectDescription.getBundleClasspath();
 						modelId = iPluginModelBase.getPluginBase().getId();
 						out.write("\n"+modelId + "=");
 						for(IBundleClasspathEntry bcpe: allCPEntry){
 							if(bcpe.getSourcePath() != null && bcpe.getBinaryPath() == null)
-								out.write(" "+javaProject.getOutputLocation().makeRelativeTo(pluginProject.getFullPath()) +",");
+								out.write(" "+ ploc.removeLastSegments(1).append(javaProject.getOutputLocation()) +",");
 							else if(bcpe.getSourcePath() != null && bcpe.getBinaryPath() != null)
 								out.write(" "+bcpe.getBinaryPath().toOSString() +",");
 							else if(bcpe.getLibrary() != null && bcpe.getLibrary().toOSString().endsWith(".jar") )
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java
index 74991f2..dc0f9bf 100644
--- a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java
@@ -27,7 +27,7 @@
 
 	public abstract IStatus canAddModule(IModule module);
 
-	public abstract String[] getFrameworkVMArguments(IPath installPath, String javaProfileID, IPath configPath,
+	public abstract String[] getFrameworkVMArguments(IPath installPath, int portNumber, String javaProfileID, IPath configPath,
 			IPath deployPath, boolean isTestEnv);
 
 	public abstract String[] getExcludedFrameworkProgramArguments(boolean debug,
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java
index 315a88c..8607520 100644
--- a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java
@@ -96,8 +96,9 @@
 			}
 		}
 		String javaProfileID = ((IEquinoxFrameworkInstance)this.getFrameworkInstance()).getJavaPofile();
+		int jmxPort = ((IEquinoxFrameworkInstance)this.getFrameworkInstance()).getJMXPort();
 
-		return getEquinoxVersionHandler().getFrameworkVMArguments(installPath, javaProfileID, null, deployPath, false);
+		return getEquinoxVersionHandler().getFrameworkVMArguments(installPath, jmxPort,javaProfileID, null, deployPath, false);
 	}
 	
 	protected void publishServer(int kind, IProgressMonitor monitor)