Blob Blame History Raw
diff --git a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java
index 86f83ef..14cdc34 100644
--- a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java
+++ b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java
@@ -688,6 +688,9 @@
                 throw new RuntimeException("The jython jar must be specified as the interpreter to run. Found: "
                         + interpreter);
             }
+            if (interpreter.toOSString().endsWith("jython")) {
+                cmdArgs.add(interpreter.toOSString());
+            } else {
             cmdArgs.add(javaLoc);
 
             //some nice things on the classpath config: http://mindprod.com/jgloss/classpath.html
@@ -703,6 +706,7 @@
             cpath = interpreter + SimpleRunner.getPythonPathSeparator() + pythonpathUsed;
             //            }
             cmdArgs.add(cpath);
+            }
             cmdArgs.add("-Dpython.path=" + pythonpathUsed); //will be added to the env variables in the run (check if this works on all platforms...)
 
             addVmArgs(cmdArgs);
@@ -714,8 +718,14 @@
                 //cmdArgs.add("-Dpython.security.respectJavaAccessibility=false");
 
                 cmdArgs.add("org.python.util.jython");
+                if (!interpreter.toOSString().endsWith("jython")) {
+                    cmdArgs.add("org.python.util.jython");
+                }
                 addDebugArgs(cmdArgs, "jython", actualRun, addWithDashMFlag, modName);
             } else {
+                if (!interpreter.toOSString().endsWith("jython")) {
+                    cmdArgs.add("org.python.util.jython");
+                }
                 cmdArgs.add("org.python.util.jython");
             }
 
diff --git a/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java b/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java
index 1b3d84c..6214e08 100644
--- a/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java
+++ b/plugins/org.python.pydev/src/org/python/pydev/runners/SimpleJythonRunner.java
@@ -74,19 +74,24 @@ public class SimpleJythonRunner extends SimpleRunner {
             String javaLoc = javaExecutable.getCanonicalPath();
             String[] s;
 
-            //In Jython 2.5b0, if we don't set python.home, it won't be able to calculate the correct PYTHONPATH
-            //(see http://bugs.jython.org/issue1214 )
-
-            String pythonHome = new File(jythonJar).getParent().toString();
-
-            if (additionalPythonpath != null) {
-                jythonJar += SimpleRunner.getPythonPathSeparator();
-                jythonJar += additionalPythonpath;
-                s = new String[] { javaLoc, "-Dpython.path=" + additionalPythonpath, "-Dpython.home=" + pythonHome,
-                        "-classpath", jythonJar, "org.python.util.jython", script };
+            if (new File(jythonJar).getName().equals("jython")) {
+                //The system jython can simply be invoked directly
+                s = new String[] { jythonJar, script };
             } else {
-                s = new String[] { javaLoc, "-Dpython.home=" + pythonHome, "-classpath", jythonJar,
-                        "org.python.util.jython", script };
+                //In Jython 2.5b0, if we don't set python.home, it won't be able to calculate the correct PYTHONPATH
+                //(see http://bugs.jython.org/issue1214 )
+
+                String pythonHome = new File(jythonJar).getParent().toString();
+
+                if (additionalPythonpath != null) {
+                    jythonJar += SimpleRunner.getPythonPathSeparator();
+                    jythonJar += additionalPythonpath;
+                    s = new String[] { javaLoc, "-Dpython.path=" + additionalPythonpath, "-Dpython.home=" + pythonHome,
+                            "-classpath", jythonJar, "org.python.util.jython", script };
+                } else {
+                    s = new String[] { javaLoc, "-Dpython.home=" + pythonHome, "-classpath", jythonJar,
+                            "org.python.util.jython", script };
+                }
             }
 
             if (args != null && args.length > 0) {
@@ -158,6 +163,19 @@ public class SimpleJythonRunner extends SimpleRunner {
             cacheDir = "-Dpython.cachedir=" + cacheDir.trim();
         }
 
+        if (new File(jythonJar).getName().equals("jython")) {
+            //The system jython can simply be invoked directly
+            List<String> asList = new ArrayList<String>();
+            asList.add(jythonJar);
+            if (cacheDir != null) {
+                asList.add(cacheDir);
+            }
+            asList.add("-Dpython.path=" + jythonPath.toString());
+            asList.addAll(Arrays.asList(script));
+            asList.addAll(Arrays.asList(args));
+            return asList.toArray(new String[0]);
+        }
+
         String[] vmArgsList = ProcessUtils.parseArguments(vmArgs);
         String[] s = new String[] {
                 "-Dpython.path=" + jythonPath.toString(),
diff --git a/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java b/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java
index 9bd8d88..48ea995 100644
--- a/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java
+++ b/plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/InterpreterInfo.java
@@ -1457,9 +1457,9 @@ public class InterpreterInfo implements IInterpreterInfo {
      */
     public static boolean isJythonExecutable(String executable) {
         if (executable.endsWith("\"")) {
-            return executable.endsWith(".jar\"");
+            return executable.endsWith(".jar\"") || executable.endsWith("jython\"");
         }
-        return executable.endsWith(".jar");
+        return executable.endsWith(".jar") || executable.endsWith("jython");
     }
 
     /**