| author | wenzelm |
| Tue, 29 Apr 2014 13:32:13 +0200 | |
| changeset 56782 | 433cf57550fa |
| parent 56671 | 06853449cf0a |
| child 56890 | 7f120d227ca5 |
| permissions | -rw-r--r-- |
| 50687 | 1 |
/* Title: Pure/Tools/main.scala |
|
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
3 |
|
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
4 |
Main Isabelle application entry point. |
|
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
6 |
|
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
8 |
|
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
9 |
|
| 55618 | 10 |
import java.lang.{Class, ClassLoader}
|
| 53461 | 11 |
import java.io.{File => JFile, BufferedReader, InputStreamReader}
|
12 |
import java.nio.file.Files |
|
13 |
||
14 |
import scala.annotation.tailrec |
|
|
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
15 |
|
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
16 |
|
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
17 |
object Main |
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
18 |
{
|
| 53461 | 19 |
/** main entry point **/ |
20 |
||
| 53456 | 21 |
def main(args: Array[String]) |
| 53449 | 22 |
{
|
| 53456 | 23 |
val system_dialog = new System_Dialog |
24 |
||
25 |
def exit_error(exn: Throwable): Nothing = |
|
26 |
{
|
|
27 |
GUI.dialog(null, "Isabelle", GUI.scrollable_text(Exn.message(exn))) |
|
|
56667
65e84b0ef974
more abstract Exn.Interrupt and POSIX return code;
wenzelm
parents:
56661
diff
changeset
|
28 |
system_dialog.return_code(Exn.return_code(exn, 2)) |
| 53460 | 29 |
system_dialog.join_exit |
| 53456 | 30 |
} |
31 |
||
32 |
def build |
|
33 |
{
|
|
34 |
try {
|
|
35 |
GUI.init_laf() |
|
36 |
Isabelle_System.init() |
|
| 53449 | 37 |
|
| 53456 | 38 |
val mode = Isabelle_System.getenv("JEDIT_BUILD_MODE")
|
39 |
if (mode == "none") |
|
40 |
system_dialog.return_code(0) |
|
41 |
else {
|
|
|
53519
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
42 |
val options = Options.init() |
| 53456 | 43 |
val system_mode = mode == "" || mode == "system" |
|
53519
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
44 |
val more_dirs = Path.split(Isabelle_System.getenv("JEDIT_SESSION_DIRS")).map((false, _))
|
| 53456 | 45 |
val session = Isabelle_System.default_logic( |
46 |
Isabelle_System.getenv("JEDIT_LOGIC"),
|
|
47 |
options.string("jedit_logic"))
|
|
|
53519
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
48 |
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
49 |
if (Build.build(options = options, build_heap = true, no_build = true, |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
50 |
more_dirs = more_dirs, sessions = List(session)) == 0) |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
51 |
system_dialog.return_code(0) |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
52 |
else {
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
53 |
system_dialog.title("Isabelle build (" + Isabelle_System.getenv("ML_IDENTIFIER") + ")")
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
54 |
system_dialog.echo("Build started for Isabelle/" + session + " ...")
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
55 |
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
56 |
val (out, rc) = |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
57 |
try {
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
58 |
("",
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
59 |
Build.build(options = options, progress = system_dialog, |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
60 |
build_heap = true, more_dirs = more_dirs, |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
61 |
system_mode = system_mode, sessions = List(session))) |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
62 |
} |
|
56671
06853449cf0a
explicit Exn.error_message in accordance to Output.error_message in ML;
wenzelm
parents:
56667
diff
changeset
|
63 |
catch {
|
|
56782
433cf57550fa
more systematic Isabelle output, like in classic Isabelle/ML (without markup);
wenzelm
parents:
56671
diff
changeset
|
64 |
case exn: Throwable => |
|
433cf57550fa
more systematic Isabelle output, like in classic Isabelle/ML (without markup);
wenzelm
parents:
56671
diff
changeset
|
65 |
(Output.error_text(Exn.message(exn)) + "\n", Exn.return_code(exn, 2)) |
|
56671
06853449cf0a
explicit Exn.error_message in accordance to Output.error_message in ML;
wenzelm
parents:
56667
diff
changeset
|
66 |
} |
|
53519
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
67 |
|
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
68 |
system_dialog.echo(out + (if (rc == 0) "OK\n" else "Return code: " + rc + "\n")) |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
69 |
system_dialog.return_code(rc) |
|
3c977c570e20
discontinued obsolete command-line tool "isabelle build_dialog";
wenzelm
parents:
53466
diff
changeset
|
70 |
} |
| 53456 | 71 |
} |
72 |
} |
|
73 |
catch { case exn: Throwable => exit_error(exn) }
|
|
74 |
} |
|
| 53449 | 75 |
|
| 53456 | 76 |
def start |
77 |
{
|
|
78 |
val do_start = |
|
79 |
{
|
|
80 |
try {
|
|
81 |
/* settings directory */ |
|
82 |
||
83 |
val settings_dir = Path.explode("$JEDIT_SETTINGS")
|
|
84 |
Isabelle_System.mkdirs(settings_dir + Path.explode("DockableWindowManager"))
|
|
85 |
||
86 |
if (!(settings_dir + Path.explode("perspective.xml")).is_file) {
|
|
87 |
File.write(settings_dir + Path.explode("DockableWindowManager/perspective-view0.xml"),
|
|
| 53772 | 88 |
"""<DOCKING LEFT="" TOP="" RIGHT="isabelle-documentation" BOTTOM="" LEFT_POS="0" TOP_POS="0" RIGHT_POS="250" BOTTOM_POS="250" />""") |
| 53456 | 89 |
File.write(settings_dir + Path.explode("perspective.xml"),
|
90 |
"""<?xml version="1.0" encoding="UTF-8" ?> |
|
91 |
<!DOCTYPE PERSPECTIVE SYSTEM "perspective.dtd"> |
|
92 |
<PERSPECTIVE> |
|
93 |
<VIEW PLAIN="FALSE"> |
|
94 |
<GEOMETRY X="0" Y="35" WIDTH="1072" HEIGHT="787" EXT_STATE="0" /> |
|
95 |
</VIEW> |
|
96 |
</PERSPECTIVE>""") |
|
97 |
} |
|
| 53449 | 98 |
|
99 |
||
| 53456 | 100 |
/* args */ |
101 |
||
102 |
val jedit_options = |
|
103 |
Isabelle_System.getenv_strict("JEDIT_OPTIONS").split(" +")
|
|
104 |
||
105 |
val jedit_settings = |
|
106 |
Array("-settings=" + Isabelle_System.platform_path(Path.explode("$JEDIT_SETTINGS")))
|
|
107 |
||
108 |
val more_args = |
|
109 |
if (args.isEmpty) |
|
110 |
Array(Isabelle_System.platform_path(Path.explode("$USER_HOME/Scratch.thy")))
|
|
111 |
else args |
|
112 |
||
113 |
||
114 |
/* startup */ |
|
|
53445
811db2b751ed
warm start of Isabelle/jEdit from Isabelle/Scala;
wenzelm
parents:
53423
diff
changeset
|
115 |
|
|
53965
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
116 |
update_environment() |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
117 |
|
| 53456 | 118 |
System.setProperty("jedit.home",
|
119 |
Isabelle_System.platform_path(Path.explode("$JEDIT_HOME/dist")))
|
|
120 |
||
121 |
System.setProperty("scala.home",
|
|
122 |
Isabelle_System.platform_path(Path.explode("$SCALA_HOME")))
|
|
123 |
||
|
53912
f6fb8ca4517f
initialize class immediately (potentially more robust);
wenzelm
parents:
53772
diff
changeset
|
124 |
val jedit = |
|
f6fb8ca4517f
initialize class immediately (potentially more robust);
wenzelm
parents:
53772
diff
changeset
|
125 |
Class.forName("org.gjt.sp.jedit.jEdit", true, ClassLoader.getSystemClassLoader)
|
| 53456 | 126 |
val jedit_main = jedit.getDeclaredMethod("main", classOf[Array[String]])
|
127 |
||
128 |
() => jedit_main.invoke(null, jedit_options ++ jedit_settings ++ more_args) |
|
129 |
} |
|
130 |
catch { case exn: Throwable => exit_error(exn) }
|
|
131 |
} |
|
132 |
do_start() |
|
133 |
} |
|
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
134 |
|
|
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
135 |
if (Platform.is_windows) {
|
| 53459 | 136 |
try {
|
137 |
GUI.init_laf() |
|
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
138 |
|
|
53967
bfaae48b0ce0
simplified ISABELLE_HOME on Windows (see also 9c8a1b9c0630, 5a7903ba2dac);
wenzelm
parents:
53966
diff
changeset
|
139 |
val isabelle_home0 = System.getenv("ISABELLE_HOME")
|
| 53459 | 140 |
val isabelle_home = System.getProperty("isabelle.home")
|
|
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
141 |
|
| 53459 | 142 |
if (isabelle_home0 == null || isabelle_home0 == "") {
|
143 |
if (isabelle_home == null || isabelle_home == "") |
|
144 |
error("Unknown Isabelle home directory")
|
|
145 |
if (!(new JFile(isabelle_home)).isDirectory) |
|
146 |
error("Bad Isabelle home directory: " + quote(isabelle_home))
|
|
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
147 |
|
| 53459 | 148 |
val cygwin_root = isabelle_home + "\\contrib\\cygwin" |
149 |
if ((new JFile(cygwin_root)).isDirectory) |
|
150 |
System.setProperty("cygwin.root", cygwin_root)
|
|
| 53422 | 151 |
|
| 53459 | 152 |
val uninitialized_file = new JFile(cygwin_root, "isabelle\\uninitialized") |
153 |
val uninitialized = uninitialized_file.isFile && uninitialized_file.delete |
|
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
154 |
|
| 53461 | 155 |
if (uninitialized) cygwin_init(system_dialog, isabelle_home, cygwin_root) |
|
53419
1c87e79bb838
main application entry point involves implicit Cygwin init, depending on "uninitialized" file indicator;
wenzelm
parents:
52675
diff
changeset
|
156 |
} |
| 53459 | 157 |
} |
158 |
catch { case exn: Throwable => exit_error(exn) }
|
|
|
53462
c531db093680
observe "stopped" after Cygwin init (which is itself uninterruptible);
wenzelm
parents:
53461
diff
changeset
|
159 |
|
|
c531db093680
observe "stopped" after Cygwin init (which is itself uninterruptible);
wenzelm
parents:
53461
diff
changeset
|
160 |
if (system_dialog.stopped) {
|
|
56667
65e84b0ef974
more abstract Exn.Interrupt and POSIX return code;
wenzelm
parents:
56661
diff
changeset
|
161 |
system_dialog.return_code(Exn.Interrupt.return_code) |
|
53462
c531db093680
observe "stopped" after Cygwin init (which is itself uninterruptible);
wenzelm
parents:
53461
diff
changeset
|
162 |
system_dialog.join_exit |
|
c531db093680
observe "stopped" after Cygwin init (which is itself uninterruptible);
wenzelm
parents:
53461
diff
changeset
|
163 |
} |
| 53459 | 164 |
} |
|
53445
811db2b751ed
warm start of Isabelle/jEdit from Isabelle/Scala;
wenzelm
parents:
53423
diff
changeset
|
165 |
|
| 53459 | 166 |
build |
167 |
val rc = system_dialog.join |
|
168 |
if (rc == 0) start else sys.exit(rc) |
|
|
53445
811db2b751ed
warm start of Isabelle/jEdit from Isabelle/Scala;
wenzelm
parents:
53423
diff
changeset
|
169 |
} |
| 53461 | 170 |
|
171 |
||
172 |
||
173 |
/** Cygwin init (e.g. after extraction via 7zip) **/ |
|
174 |
||
175 |
private def cygwin_init(system_dialog: System_Dialog, isabelle_home: String, cygwin_root: String) |
|
176 |
{
|
|
177 |
system_dialog.title("Isabelle system initialization")
|
|
| 53466 | 178 |
system_dialog.echo("Initializing Cygwin ...")
|
| 53461 | 179 |
|
180 |
def execute(args: String*): Int = |
|
181 |
{
|
|
182 |
val cwd = new JFile(isabelle_home) |
|
183 |
val env = Map("CYGWIN" -> "nodosfilewarning")
|
|
184 |
system_dialog.execute(cwd, env, args: _*) |
|
185 |
} |
|
186 |
||
187 |
system_dialog.echo("symlinks ...")
|
|
188 |
val symlinks = |
|
189 |
{
|
|
190 |
val path = (new JFile(cygwin_root + "\\isabelle\\symlinks")).toPath |
|
191 |
Files.readAllLines(path, UTF8.charset).toArray.toList.asInstanceOf[List[String]] |
|
192 |
} |
|
193 |
@tailrec def recover_symlinks(list: List[String]): Unit = |
|
194 |
{
|
|
195 |
list match {
|
|
196 |
case Nil | List("") =>
|
|
197 |
case link :: content :: rest => |
|
198 |
val path = (new JFile(isabelle_home, link)).toPath |
|
199 |
||
200 |
val writer = Files.newBufferedWriter(path, UTF8.charset) |
|
|
56661
ef623f6f036b
avoid octal escape literals -- deprecated in scala-2.11.0;
wenzelm
parents:
55618
diff
changeset
|
201 |
try { writer.write("!<symlink>" + content + "\u0000") }
|
| 53461 | 202 |
finally { writer.close }
|
203 |
||
204 |
Files.setAttribute(path, "dos:system", true) |
|
205 |
||
206 |
recover_symlinks(rest) |
|
207 |
case _ => error("Unbalanced symlinks list")
|
|
208 |
} |
|
209 |
} |
|
210 |
recover_symlinks(symlinks) |
|
211 |
||
212 |
system_dialog.echo("rebaseall ...")
|
|
213 |
execute(cygwin_root + "\\bin\\dash.exe", "/isabelle/rebaseall") |
|
214 |
||
215 |
system_dialog.echo("postinstall ...")
|
|
216 |
execute(cygwin_root + "\\bin\\bash.exe", "/isabelle/postinstall") |
|
217 |
||
218 |
system_dialog.echo("init ...")
|
|
219 |
Isabelle_System.init() |
|
220 |
} |
|
|
53965
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
221 |
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
222 |
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
223 |
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
224 |
/** adhoc update of JVM environment variables **/ |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
225 |
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
226 |
def update_environment() |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
227 |
{
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
228 |
val update = |
|
53966
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
229 |
{
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
230 |
val isabelle_home = Isabelle_System.getenv("ISABELLE_HOME")
|
| 54351 | 231 |
val isabelle_home_user = Isabelle_System.getenv("ISABELLE_HOME_USER")
|
|
53966
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
232 |
val upd = |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
233 |
if (Platform.is_windows) |
| 54351 | 234 |
List( |
235 |
"ISABELLE_HOME" -> Isabelle_System.jvm_path(isabelle_home), |
|
236 |
"ISABELLE_HOME_USER" -> Isabelle_System.jvm_path(isabelle_home_user), |
|
237 |
"INI_DIR" -> "") |
|
|
53966
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
238 |
else |
| 54351 | 239 |
List( |
240 |
"ISABELLE_HOME" -> isabelle_home, |
|
241 |
"ISABELLE_HOME_USER" -> isabelle_home_user) |
|
|
53965
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
242 |
|
|
53966
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
243 |
(env0: Any) => {
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
244 |
val env = env0.asInstanceOf[java.util.Map[String, String]] |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
245 |
upd.foreach {
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
246 |
case (x, "") => env.remove(x) |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
247 |
case (x, y) => env.put(x, y) |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
248 |
} |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
249 |
} |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
250 |
} |
|
53965
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
251 |
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
252 |
classOf[java.util.Collections].getDeclaredClasses |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
253 |
.find(c => c.getName == "java.util.Collections$UnmodifiableMap") match |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
254 |
{
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
255 |
case Some(c) => |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
256 |
val m = c.getDeclaredField("m")
|
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
257 |
m.setAccessible(true) |
|
53966
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
258 |
update(m.get(System.getenv())) |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
259 |
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
260 |
if (Platform.is_windows) {
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
261 |
val ProcessEnvironment = Class.forName("java.lang.ProcessEnvironment")
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
262 |
val field = ProcessEnvironment.getDeclaredField("theCaseInsensitiveEnvironment")
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
263 |
field.setAccessible(true) |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
264 |
update(field.get(null)) |
|
53965
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
265 |
} |
|
53966
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
266 |
|
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
267 |
case None => |
|
5a546a881f90
update second environment that is used for System.getenv(String);
wenzelm
parents:
53965
diff
changeset
|
268 |
error("Failed to update JVM environment -- platform incompatibility")
|
|
53965
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
269 |
} |
|
cca95e9055ba
adhoc update of JVM environment variables, which is relevant for cold start of jEdit;
wenzelm
parents:
53912
diff
changeset
|
270 |
} |
|
47663
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
271 |
} |
|
20e0865ae9e7
default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff
changeset
|
272 |