My operating system: Windows Server R2 Enterprise (64-bit)
To install Jython2.7 steps:
1. Install Vc2008_vcredist_x86.exe (Note: Although the operating system is 64-bit, Jython2.7 relies on 32-bit VC9.0)
2. Install Jdk-8u25-windows-x64.exe (Note: Jython2.7 requirements >=jdk1.7,jdk1.8 suitable for WIN7 and win2k8, JDK1.6 for WinXP), installation path does not include spaces and Chinese
3. Setting environment variables: java_home, Jre_home, CLASSPATH, PATH
Set Java_home=c:\java\jdk1. 8 . 0_25 Set Jre_home=%java_home%\jreset classpath=.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jarset Path=%java_home%\bin;%jre_home%\bin;%path %
4. Reboot and verify
Javac-version
5. Installing Jython-installer-2.7.0.jar
-jar jython-installer-2.7. 0. Jar--Helpgraphical installation Jython2. 7 -jar jython-installer-2.7. 0 The . Jar Console mode installs the Jython2. 7 -jar jython-installer-2.7. 0. jar-console
6. Setting Environment variables: jython_home
Set Jython_home=c:\jython2. 7.0 Set path=%jython_home%\bin;%path%
7. Verify Jython
C:\jython2.7.0\bin>the volume in Dir drive C is not labeled. The serial number of the volume is 88d3-f4d5 C:\jython2.7.0directory for \ Bin -/ -/ - -: +<DIR> . -/ -/ - -: +<DIR> .. -/ -/ - -: - the,087easy_install-2.7. EXE -/ -/ - -: - the,087Easy_install.exe -/Geneva/ in Geneva: - 1,236,153Jython.exe -/ -/ - -: + the,059Pip.exe -/ -/ - -: + the,059Pip2.7. EXE -/ -/ - -: + the,059Pip2.exe -/Geneva/ in Geneva: - 2,459,136Python27.dll7A file4, the,640bytes2List of the,630,317,056Available Bytes \ c>Jythonjython2.7.0(default: 9987c746f838, APR in -, Geneva: -: One) [Java HotSpot (TM) --bit Server VM (Oracle Corporation) on JAVA1.8. 0_25type" Help","Copyright","credits"Or"License" forMore information.>>>exit () \ c \>
View Code
At this point, Jython2.7 has been installed.
If Vc2008_vcredist_x86.exe is not installed, you will be prompted as follows when you run Jython:
c:\>jythonerror Loading Python dll:c:\jython~1.014001)
Recommendation: Remove the Jython2.7 installation directory, install Vc2008_vcredist_x86.exe, and then install Jython-installer-2.7.0.jar
When using DEPENDS. EXE to find the target dependency relationship is also not a clue, through the Sxstrace tool tracking may be able to find some clues, I was the tool to determine the following dependencies:
Jython-installer-2.7.0.jar Dependent Vc2008_vcredist_x86.exe
Python-2.7.9.amd64.msi Dependent Vc2008_vcredist_x64.exe
The Sxstrace tool is used as follows:
-logfile:c:/temp/1-logfile:c:/temp/1. txt-outfile:c:/temp/2. txt
The following post Sxstrace trace Jython2.7 run-time message, from the log can be seen, it relies on 32-bit VC9.0
=================starts the build activation context. Input parameters: Flags=0processorarchitecture=Wow32 culturefallbacks= zh-cn;zh-hans;zh;en-us;en Manifestpath= c:\jython~1.0\bin\python27.dll assemblydirectory= c:\jython~1.0\ Bin Application Config File= -----------------Info: Parsing manifest file C:\JYTHON~1.0\bin\python27.dll. Info: The manifest definition identity is (NULL). Info: reference: Microsoft.vc90.crt,processorarchitecture="x86", publickeytoken="1fc8b3b9a1e18e3b", type="Win32", version="9.0.21022.8"Info: Parsing reference microsoft.vc90.crt,processorarchitecture="x86", publickeytoken="1fc8b3b9a1e18e3b", type="Win32", version="9.0.21022.8". Info: Parsing processorarchitecture WOW64 Reference. Info: The reference for the culture Neutral is being parsed. Info: Binding policy is being applied. Info: publisher policy not found. Info: Binding policy redirection not found. Info: Start assembly probing. Info: The assembly in WinSxS was not found. Info: Try the C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT\9.0.21022. 8__1fc8b3b9a1e18e3b\microsoft.vc90.crt.dll on the probe manifest. Info: The list of directives for the culture Neutral was not found. Info: End assembly probing. Info: Parsing processorarchitecture x86 reference. Info: The reference for the culture Neutral is being parsed. Info: Binding policy is being applied. Info: publisher policy not found. Info: Binding policy redirection not found. Info: Start assembly probing. Info: The assembly in WinSxS was not found. Info: Try the C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT\9.0.21022. 8__1fc8b3b9a1e18e3b\microsoft.vc90.crt.dll on the probe manifest. Info: Try the C:\JYTHON~1.0\bin\microsoft.vc90.crt.dll on the probe list. Info: Try the C:\JYTHON~1.0\bin\microsoft.vc90.crt.manifest on the probe list. Info: Try the C:\JYTHON~1.0\bin\microsoft.vc90.crt\microsoft.vc90.crt.dll on the probe list. Info: Try the C:\JYTHON~1.0\bin\microsoft.vc90.crt\microsoft.vc90.crt.manifest on the probe list. Info: The list of directives for the culture Neutral was not found. Info: End assembly probing. Error: Unable to parse reference microsoft.vc90.crt,processorarchitecture="x86", publickeytoken="1fc8b3b9a1e18e3b", type="Win32", version="9.0.21022.8". Error: Failed to generate activation context. Ends the build activation context.
View Code
The following post Sxstrace tracking Python2.7 installation of the message, from the log can be seen, it relies on 64-bit VC9.0
=================starts the build activation context. Input parameters: Flags=0processorarchitecture=AMD64 culturefallbacks= zh-cn;zh-hans;zh;en-us;en Manifestpath=C:\Python27\python.exe assemblydirectory=C:\Python27 application Config File= -----------------Info: Parsing manifest file C:\Python27\python.exe. Info: The manifest definition identity is (NULL). Info: reference: Microsoft.vc90.crt,processorarchitecture="AMD64", publickeytoken="1fc8b3b9a1e18e3b", type="Win32", version="9.0.21022.8"Info: Parsing reference microsoft.vc90.crt,processorarchitecture="AMD64", publickeytoken="1fc8b3b9a1e18e3b", type="Win32", version="9.0.21022.8". Info: Parsing processorarchitecture amd64 Reference. Info: The reference for the culture Neutral is being parsed. Info: Binding policy is being applied. Info: publisher policy not found. Info: Binding policy redirection not found. Info: Start assembly probing. Info: The assembly in WinSxS was not found. Info: Try the C:\Windows\assembly\GAC_64\Microsoft.VC90.CRT\9.0.21022. 8__1fc8b3b9a1e18e3b\microsoft.vc90.crt.dll on the probe manifest. Info: Try to probe the manifest on the C:\Python27\Microsoft.VC90.CRT.DLL. Info: Try to probe the manifest on the C:\Python27\Microsoft.VC90.CRT.MANIFEST. Info: Try to probe the manifest on the C:\Python27\Microsoft.VC90.CRT\Microsoft.VC90.CRT.DLL. Info: Try to probe the manifest on the C:\Python27\Microsoft.VC90.CRT\Microsoft.VC90.CRT.MANIFEST. Info: The list of directives for the culture Neutral was not found. Info: End assembly probing. Error: Unable to parse reference microsoft.vc90.crt,processorarchitecture="AMD64", publickeytoken="1fc8b3b9a1e18e3b", type="Win32", version="9.0.21022.8". Error: Failed to generate activation context. Ends the build activation context.
View Code
Jython2.7 Application Scenario:
After Jython imports the wl.py module, the WLST scripting language enables real-time interaction with WebLogic.
Make sure that WebLogic is started, and then execute the following code:
@ECHO offsetlocal Set Wl_home=c:\oracle\middleware\wlserver_10. 3 "%wl_home%\server\bin\setwlsenv.cmd"- dweblogic.security.ssl.ignorehostnameverification=true ^ -dweblogic.security.trustkeystore= Demotrust ^ ^ helloworld.pyendlocal
The helloworld.py code is as follows:
#!/usr/bin/Env jython#-*-coding:utf-8-*-Import osimport wlimport syssys.path.append ('C:\\jython2.7.0\\lib') Sys.path.append ('c:\\jython2.7.0\\lib\\site-packages') Username='WebLogic'Password='12345678'# NO Ssl#wl.connect (username, password,'t3://localhost:7001') # sslwl.connect (username, password,'t3s://localhost:7002') Wl.disconnect ()
Currently, a problem has been found: When only Jython is started, all its modules can be imported, but when it is weblogic through Java. WLST helloworld.py mode startup, some of the Jython module will not be imported, see my post: http://segmentfault.com/q/1010000003003164
Jython WLST WebLogic