752
|
1 |
"{ Package: 'stx:libjava/startup' }"
|
|
2 |
|
|
3 |
StandaloneStartup subclass:#JavaStartup
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:'ClassPath'
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Languages-Java-Support'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!JavaStartup class methodsFor:'constants & defaults'!
|
|
12 |
|
|
13 |
applicationRegistryPath
|
|
14 |
"the key under which this application stores its process ID in the registry
|
|
15 |
as a collection of path-components.
|
|
16 |
i.e. if #('foo' 'bar' 'baz') is returned here, the current applications ID will be stored
|
|
17 |
in HKEY_CURRENT_USER\Software\foo\bar\baz\CurrentID.
|
|
18 |
(would also be used as a relative path for a temporary lock file under unix).
|
|
19 |
Used to detect if another instance of this application is already running."
|
|
20 |
|
|
21 |
^ #('stx' 'java_x')
|
|
22 |
|
|
23 |
"Created: / 07-02-2011 / 10:55:08 / Marcel Hlopko <hlopik@gmail.com>"
|
|
24 |
!
|
|
25 |
|
|
26 |
applicationUUID
|
|
27 |
"answer an application-specific unique uuid.
|
|
28 |
This is used as the name of some exclusive OS-resource, which is used to find out,
|
|
29 |
if another instance of this application is already running.
|
|
30 |
Under win32, a mutex is used; under unix, an exclusive file in the tempDir could be used."
|
|
31 |
|
|
32 |
^ 'ST_X_JAVA_X'.
|
|
33 |
|
|
34 |
"Created: / 07-02-2011 / 10:52:50 / Marcel Hlopko <hlopik@gmail.com>"
|
|
35 |
! !
|
|
36 |
|
|
37 |
!JavaStartup class methodsFor:'startup'!
|
|
38 |
|
|
39 |
main:argv
|
|
40 |
"Currently only -c option for classpath setting working"
|
|
41 |
|
|
42 |
|class arguments classAndArguments classpath classpathFromEnv|
|
|
43 |
|
|
44 |
classpath := OrderedCollection new.
|
|
45 |
classpathFromEnv := OperatingSystem getEnvironment:#CLASSPATH.
|
|
46 |
classpathFromEnv isNil ifFalse:[
|
|
47 |
(classpathFromEnv asArrayOfSubstringsSeparatedBy:$:) do:[:each |
|
|
48 |
classpath add:each
|
|
49 |
]
|
|
50 |
].
|
|
51 |
classAndArguments := OrderedCollection new.
|
|
52 |
(GetOpt new)
|
|
53 |
at:$c
|
|
54 |
put:[:opt :arg | (arg asArrayOfSubstringsSeparatedBy:$:) do: [:each | classpath add: each]];
|
|
55 |
at:$? put:[:arg | self error:'not yet implemented'];
|
|
56 |
default:[:arg | classAndArguments add:arg];
|
|
57 |
parse:argv.
|
|
58 |
class := classAndArguments at:1.
|
|
59 |
arguments := classAndArguments
|
|
60 |
removeFirst;
|
|
61 |
yourself.
|
|
62 |
Java flushAllJavaResources.
|
|
63 |
self breakPoint:#mh.
|
|
64 |
Java initialize.
|
|
65 |
JavaVM initializeVM.
|
|
66 |
classpath do:[:each |
|
|
67 |
Java addToClassPath:each
|
|
68 |
].
|
|
69 |
(Java classForName:class) main:arguments asArray.
|
|
70 |
|
|
71 |
"Created: / 07-02-2011 / 10:55:41 / Marcel Hlopko <hlopik@gmail.com>"
|
|
72 |
"Modified: / 08-02-2011 / 00:55:42 / Marcel Hlopko <hlopik@gmail.com>"
|
|
73 |
! !
|
|
74 |
|
|
75 |
!JavaStartup class methodsFor:'documentation'!
|
|
76 |
|
|
77 |
version_SVN
|
|
78 |
^ '$Id$'
|
|
79 |
! !
|