'How do I set the Environment variables for Jython?
I have set the variables JYTHON_HOME to the directory where I have installed Jython and JYTHON_PATH to the bin folder, but I still get the following error when I try to run jython:
'jython' is not recognized as an internal or external command,
operable program or batch file.
Why do I get this error? The Java installation has no issues.
Solution 1:[1]
I am Windows user & I have installed Jython in C:\jython2.7.0.
What I had before?
I had neither set the JYTHON_HOME environment variable nor added %JYTHON_HOME%\bin to PATH environment variable. I also got the same error as shown in the question.
How I fixed?
- I created new environment variable named
JYTHON_HOMEwith valueC:\jython2.7.0.
You've to use your own Jython's installation folder.
- Then I added
%JYTHON_HOME%\bintoPATHenvironment variable as the below 2 image shows.
Create new PATH environment variable if it is not already there (This is rare case).
- Open new Terminal and type
jython, it will work. Now you can try executing simple Python statements as the below image shows.
Do not use the already opened Terminal.
That's it.
Solution 2:[2]
You still need to add the path to the executable jython.bat to your PATH environment variable. Here as an example I'm providing my ini-jython.bat, which I use before executing my jython project (in this case it's a Django on Jython project, you can safely ignore the Django stuff, or adapt it to your needs):
set JYTHON_HOME=c:\tools\jython2.5.2
set PATH=%JYTHON_HOME%\bin;%PATH%
set CLASSPATH=dep1;dep1/lib/*;_lib/*
set JYTHONPATH=.;..\django-debug-toolbar;..\django-common
set DJANGO_SETTINGS_MODULE=site_projname.settings
set PYTHONPATH=%JYTHONPATH%
set manage=jython c:\tools\jython2.5.2\bin\django-admin.py
set makemessages=django-admin makemessages --extension html,py
set compilemessages=django-admin compilemessages
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 |



