-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathjes.bat
123 lines (80 loc) · 2.88 KB
/
jes.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@echo off
setlocal EnableDelayedExpansion
rem Launches JES in place on Windows.
rem This will keep a Command Prompt window open,
rem so it's suitable for debugging weird issues.
rem JES.exe just launches this file without the Command Prompt,
rem so end users should use that file.
rem Where are we?
set jes_base=%~dp0
set jes_base=%jes_base:~0,-1%
set jes_home=%jes_base%\jes
rem Is there a user configuration file?
if EXIST "%APPDATA%\JES\JESEnvironment.bat" (
call "%APPDATA%\JES\JESEnvironment.bat"
)
rem What Java should we use?
set java_exe=java.exe
set "java_bundled=%jes_base%\dependencies\jre-win32"
if DEFINED JES_JAVA_HOME (
set "java=%JES_JAVA_HOME%\bin\%java_exe%"
) else (
if EXIST "%java_bundled%" (
set "java=%java_bundled%\bin\%java_exe%"
) else (
if DEFINED JAVA_HOME (
set "java=%JAVA_HOME%\bin\%java_exe%"
) else (
set "java=%java_exe%"
)
)
)
rem Where's our Java code?
set jars=%jes_base%\dependencies\jars
set classpath=%jes_home%\classes.jar
for %%J IN ("%jars%\*.jar") DO set classpath=!classpath!;%%~fJ
rem Where's our Python code?
set pythonhome=%jes_base%\dependencies\jython
set pythonpath=%jes_home%\python;%jes_base%\dependencies\python
rem Do we have any plugins to load?
rem User plugins:
set jes_user_plugins=%APPDATA%\JES\Plugins
if NOT EXIST "%jes_user_plugins%" GOTO :nouserplugins
for %%J IN ("%jes_user_plugins%\*.jar") DO set "classpath=!classpath!;%%~fJ"
:nouserplugins
rem System plugins:
set jes_system_plugins=%jes_base%\plugins
if NOT EXIST "%jes_system_plugins%" GOTO :nosystemplugins
for %%J IN ("%jes_system_plugins%\*.jar") DO set "classpath=!classpath!;%%~fJ"
:nosystemplugins
rem Built-in plugins:
set jes_builtin_plugins=%jes_home%\builtin-plugins
if NOT EXIST "%jes_builtin_plugins%" GOTO :nobuiltinplugins
for %%J IN ("%jes_builtin_plugins%\*.jar") DO SET "classpath=!classpath!,%%~fJ"
:nobuiltinplugins
rem Where should the Jython cache live?
set pythoncache=%LOCALAPPDATA%\JES\jython-cache
if NOT EXIST "%pythoncache%" (
md "%pythoncache%"
)
rem What about JESConfig.properties?
set jesconfig=%APPDATA%\JES\JESConfig.properties
if NOT EXIST "%APPDATA%\JES" (
md "%APPDATA%\JES"
)
rem All right, time to actually run it!
if NOT DEFINED JES_JAVA_MEMORY (
set JES_JAVA_MEMORY=-Xmx512m
)
"%java%" -classpath "%classpath%" ^
-Dfile.encoding="UTF-8" ^
-Djes.home="%jes_home%" ^
-Djes.configfile="%jesconfig%" ^
-Djes.plugins.user="%jes_user_plugins%" ^
-Djes.plugins.system="%jes_system_plugins%" ^
-Djes.plugins.builtin="%jes_builtin_plugins%" ^
-Dpython.home="%pythonhome%" ^
-Dpython.path="%pythonpath%" ^
-Dpython.cachedir="%pythoncache%" ^
%JES_JAVA_MEMORY% %JES_JAVA_OPTIONS% ^
JESstartup %*