src/JavaRelease.st
branchjk_new_structure
changeset 1577 8319db430a11
parent 1557 e47ce26d5734
child 1578 ecd2bdfbf796
equal deleted inserted replaced
1576:d2ce64ae3414 1577:8319db430a11
     1 "
       
     2  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
     3 
       
     4  New code and modifications done at SWING Research Group [1]:
       
     5 
       
     6  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
     7                             SWING Research Group, Czech Technical University in Prague
       
     8 
       
     9  This software is furnished under a license and may be used
       
    10  only in accordance with the terms of that license and with the
       
    11  inclusion of the above copyright notice.   This software may not
       
    12  be provided or otherwise made available to, or used by, any
       
    13  other person.  No title to or ownership of the software is
       
    14  hereby transferred.
       
    15 
       
    16  [1] Code written at SWING Research Group contains a signature
       
    17      of one of the above copright owners. For exact set of such code,
       
    18      see the differences between this version and version stx:libjava
       
    19      as of 1.9.2010
       
    20 "
       
    21 "{ Package: 'stx:libjava' }"
       
    22 
       
    23 Object subclass:#JavaRelease
       
    24 	instanceVariableNames:'javaHome classPath sourcePath classes bootClassPathClasses
       
    25 		extDirsClasses'
       
    26 	classVariableNames:''
       
    27 	poolDictionaries:''
       
    28 	category:'Languages-Java-Support'
       
    29 !
       
    30 
       
    31 JavaRelease class instanceVariableNames:'instance'
       
    32 
       
    33 "
       
    34  No other class instance variables are inherited by this class.
       
    35 "
       
    36 !
       
    37 
       
    38 JavaRelease subclass:#Custom
       
    39 	instanceVariableNames:''
       
    40 	classVariableNames:''
       
    41 	poolDictionaries:''
       
    42 	privateIn:JavaRelease
       
    43 !
       
    44 
       
    45 JavaRelease subclass:#OpenJDK6
       
    46 	instanceVariableNames:''
       
    47 	classVariableNames:''
       
    48 	poolDictionaries:''
       
    49 	privateIn:JavaRelease
       
    50 !
       
    51 
       
    52 JavaRelease::OpenJDK6 subclass:#OpenJDK7
       
    53 	instanceVariableNames:''
       
    54 	classVariableNames:''
       
    55 	poolDictionaries:''
       
    56 	privateIn:JavaRelease
       
    57 !
       
    58 
       
    59 JavaRelease subclass:#SunJDK122
       
    60 	instanceVariableNames:''
       
    61 	classVariableNames:''
       
    62 	poolDictionaries:''
       
    63 	privateIn:JavaRelease
       
    64 !
       
    65 
       
    66 JavaRelease::OpenJDK6 subclass:#SunJDK6
       
    67 	instanceVariableNames:''
       
    68 	classVariableNames:''
       
    69 	poolDictionaries:''
       
    70 	privateIn:JavaRelease
       
    71 !
       
    72 
       
    73 !JavaRelease class methodsFor:'documentation'!
       
    74 
       
    75 copyright
       
    76 "
       
    77  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
    78 
       
    79  New code and modifications done at SWING Research Group [1]:
       
    80 
       
    81  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
    82                             SWING Research Group, Czech Technical University in Prague
       
    83 
       
    84  This software is furnished under a license and may be used
       
    85  only in accordance with the terms of that license and with the
       
    86  inclusion of the above copyright notice.   This software may not
       
    87  be provided or otherwise made available to, or used by, any
       
    88  other person.  No title to or ownership of the software is
       
    89  hereby transferred.
       
    90 
       
    91  [1] Code written at SWING Research Group contains a signature
       
    92      of one of the above copright owners. For exact set of such code,
       
    93      see the differences between this version and version stx:libjava
       
    94      as of 1.9.2010
       
    95 
       
    96 "
       
    97 ! !
       
    98 
       
    99 !JavaRelease class methodsFor:'instance creation'!
       
   100 
       
   101 custom
       
   102     ^Custom instance
       
   103 
       
   104     "Created: / 26-07-2012 / 23:37:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   105 !
       
   106 
       
   107 openJDK6
       
   108     ^ OpenJDK6 instance
       
   109 
       
   110     "Created: / 27-10-2010 / 21:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   111     "Modified: / 05-11-2011 / 18:45:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   112     "Modified: / 27-07-2012 / 00:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   113 !
       
   114 
       
   115 openJDK7
       
   116     ^ OpenJDK7 instance.
       
   117 
       
   118     "Created: / 26-07-2012 / 23:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   119 !
       
   120 
       
   121 sunJDK122
       
   122     ^ SunJDK122 instance
       
   123 
       
   124     "Created: / 27-10-2010 / 21:41:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   125     "Modified: / 05-11-2011 / 18:45:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   126     "Modified: / 27-07-2012 / 00:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   127 !
       
   128 
       
   129 sunJDK6
       
   130     ^ SunJDK6 instance
       
   131 
       
   132     "Created: / 22-11-2010 / 13:33:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   133     "Modified: / 05-11-2011 / 18:45:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   134     "Modified: / 27-07-2012 / 00:22:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   135 ! !
       
   136 
       
   137 !JavaRelease class methodsFor:'accessing'!
       
   138 
       
   139 all
       
   140     ^(self allSubclasses 
       
   141                 reject: [:rel | rel isAbstract ]
       
   142                 thenCollect: [:rel | rel instance ])
       
   143                 asSortedCollection: [:a :b | a priority > b priority ]
       
   144 
       
   145 
       
   146     "
       
   147         JavaRelease all
       
   148     "
       
   149 
       
   150     "Created: / 27-07-2012 / 00:10:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   151 !
       
   152 
       
   153 any
       
   154     | releases |
       
   155 
       
   156     releases := self available.
       
   157     releases isEmptyOrNil ifTrue:[ ^ nil ].
       
   158     ^ releases first initialize
       
   159 
       
   160 
       
   161     "
       
   162         JavaRelease any
       
   163     "
       
   164 
       
   165     "Created: / 22-11-2010 / 13:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   166     "Modified: / 01-11-2011 / 14:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   167     "Modified: / 26-07-2012 / 23:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   168 !
       
   169 
       
   170 available
       
   171     | releases |
       
   172     releases := self all select: [:rel | rel isAvailable ].
       
   173     releases isEmpty 
       
   174         ifTrue: [ self error: 'No Java release found'. ^nil ].
       
   175     ^releases
       
   176 
       
   177     "
       
   178         JavaRelease available
       
   179     "
       
   180 
       
   181     "Created: / 26-07-2012 / 23:41:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   182 ! !
       
   183 
       
   184 !JavaRelease class methodsFor:'instance creation-private'!
       
   185 
       
   186 instance
       
   187     instance isNil ifTrue:[
       
   188         instance := self new initialize
       
   189     ].
       
   190     ^instance
       
   191 
       
   192     "Created: / 27-07-2012 / 00:22:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   193 ! !
       
   194 
       
   195 !JavaRelease class methodsFor:'queries'!
       
   196 
       
   197 isAbstract
       
   198 
       
   199     ^self class == JavaRelease
       
   200 
       
   201     "Created: / 22-11-2010 / 13:33:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   202 ! !
       
   203 
       
   204 !JavaRelease methodsFor:'accessing'!
       
   205 
       
   206 bootClassPath
       
   207     "Returns a default value of sun.boot.class.path"
       
   208 
       
   209     OperatingSystem isUNIXlike ifTrue: [ ^ self bootClassPathOnUNIX ].
       
   210     OperatingSystem isMSWINDOWSlike ifTrue: [ ^ self bootClassPathOnWindows ].
       
   211     self error: 'Unsupported platform'.
       
   212         ^ #().
       
   213 
       
   214     "Created: / 02-11-2011 / 12:19:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   215 !
       
   216 
       
   217 bootClassPathOnUNIX
       
   218     "Not known..."
       
   219     ^#()
       
   220 
       
   221     "Created: / 02-11-2011 / 12:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   222     "Modified: / 27-07-2012 / 00:23:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   223 !
       
   224 
       
   225 bootClassPathOnWindows
       
   226      self subclassResponsibility.
       
   227 
       
   228     "Created: / 02-11-2011 / 12:33:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   229 !
       
   230 
       
   231 classPath
       
   232 
       
   233     "Returns a default class path"
       
   234 
       
   235     classPath ifNil:[self searchForClassPath].
       
   236     ^classPath
       
   237 
       
   238     "
       
   239         JavaRelease openJDK6 classPath
       
   240     "
       
   241 
       
   242     "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   243     "Modified: / 27-10-2010 / 21:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   244 !
       
   245 
       
   246 javaExtDirs
       
   247 
       
   248     "Returns a default value of java.ext.dirs property"
       
   249 
       
   250     OperatingSystem isUNIXlike ifTrue:[ ^ self javaExtDirsOnUNIX ].
       
   251     OperatingSystem isMSWINDOWSlike ifTrue:[ ^ self javaExtDirsOnWindows ].
       
   252     self error:'Unsupported platform'.
       
   253     ^ #()
       
   254 
       
   255 
       
   256     "
       
   257         JavaRelease openJDK6 classPath
       
   258     "
       
   259 
       
   260     "Modified: / 27-10-2010 / 21:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   261     "Created: / 31-08-2011 / 19:59:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   262 !
       
   263 
       
   264 javaExtDirsOnUNIX
       
   265 
       
   266     ^#()
       
   267 
       
   268     "Created: / 31-08-2011 / 19:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   269 !
       
   270 
       
   271 javaExtDirsOnWindows
       
   272 
       
   273     ^#()
       
   274 
       
   275     "Created: / 31-08-2011 / 19:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   276 !
       
   277 
       
   278 javaHome
       
   279 
       
   280     "Answer a Java home"
       
   281 
       
   282     javaHome isNil ifTrue:[
       
   283         javaHome := self searchForJavaHome.
       
   284     ].
       
   285     ^javaHome
       
   286 
       
   287     "
       
   288         JavaRelease openJDK6 javaHome
       
   289     "
       
   290 
       
   291     "Created: / 27-10-2010 / 18:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   292     "Modified: / 27-07-2012 / 00:24:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   293 !
       
   294 
       
   295 javaHomeOrNil
       
   296 
       
   297     "Answer a Java home"
       
   298 
       
   299     | home |
       
   300     home := (javaHome 
       
   301                 ifNotNil:[javaHome]
       
   302                 ifNil:[self searchForJavaHome]).
       
   303     ^home
       
   304 
       
   305     "
       
   306         JavaRelease openJDK6 javaHome
       
   307     "
       
   308 
       
   309     "Created: / 22-11-2010 / 13:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   310 !
       
   311 
       
   312 javaHomes
       
   313 
       
   314     "Answer a set of possible java homes, those directories are searched"
       
   315 
       
   316     
       
   317     OperatingSystem isUNIXlike ifTrue:[ ^ self javaHomesOnUNIX ].
       
   318     OperatingSystem isMSWINDOWSlike ifTrue:[ ^ self javaHomesOnWindows ].
       
   319     self error:'Unsupported platform'.
       
   320     ^ #()
       
   321 
       
   322     "Modified: / 22-11-2010 / 13:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   323 !
       
   324 
       
   325 javaHomesOnUNIX
       
   326     "raise an error: must be redefined in concrete subclass(es)"
       
   327 
       
   328     ^ self subclassResponsibility
       
   329 !
       
   330 
       
   331 javaHomesOnWindows
       
   332     "raise an error: must be redefined in concrete subclass(es)"
       
   333 
       
   334     ^ self subclassResponsibility
       
   335 !
       
   336 
       
   337 jreHome
       
   338 
       
   339     "Answers the directory where the JRE lives"
       
   340 
       
   341     | jreHome |
       
   342 
       
   343     self javaHome isNil ifTrue:[ ^ nil ].
       
   344 
       
   345     ^(jreHome := self javaHome asFilename / 'jre') exists
       
   346         ifTrue:[jreHome]
       
   347         ifFalse:[javaHome asFilename].
       
   348 
       
   349     "Created: / 27-10-2010 / 21:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   350 !
       
   351 
       
   352 name
       
   353 
       
   354     "Answer a human readable name of the Java release such as Sun JDK 1.2.2 or OpenJDK 6"
       
   355 
       
   356     ^self subclassResponsibility
       
   357 
       
   358     "Created: / 27-10-2010 / 18:53:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   359 !
       
   360 
       
   361 priority
       
   362 
       
   363     ^50
       
   364 
       
   365     "Created: / 22-11-2010 / 13:34:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   366 !
       
   367 
       
   368 selector
       
   369     "Returns instance-creation selector to get the receiver.
       
   370      See JavaRelease class, protocol instance creation"
       
   371 
       
   372     ^self subclassResponsibility
       
   373 
       
   374     "Created: / 27-07-2012 / 10:04:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   375 !
       
   376 
       
   377 sourcePath
       
   378 
       
   379     "Returns a paths where sources are located"
       
   380 
       
   381     sourcePath ifNil:[self searchForSourcePath].
       
   382     ^sourcePath
       
   383 
       
   384     "
       
   385         JavaRelease openJDK6 sourcePath        
       
   386     "
       
   387 
       
   388     "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   389     "Modified: / 30-11-2010 / 11:55:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   390 ! !
       
   391 
       
   392 !JavaRelease methodsFor:'debugging'!
       
   393 
       
   394 dumpConfigOn: stream
       
   395 
       
   396     | dumper |
       
   397     dumper := [:name :value :isfile|
       
   398         | values |
       
   399 
       
   400         '%-15s : ' printf:{ name } on: stream.
       
   401         value isString
       
   402             ifTrue:[values := { value asString }]
       
   403             ifFalse:[values := value].
       
   404         values do:[:v|
       
   405             stream nextPutAll: v asString.
       
   406             isfile ifTrue:[
       
   407                 v asFilename exists ifFalse:[
       
   408                     stream nextPutAll:' (not found!!!!!!)'
       
   409                 ].
       
   410             ]
       
   411         ] separatedBy:[stream cr; next: 15 + 3 put: Character space].
       
   412         stream cr.
       
   413     ].
       
   414 
       
   415 
       
   416 
       
   417     stream nextPutAll: '== Java release config =='; cr.
       
   418     dumper value: 'name' value: self name value: false.
       
   419     dumper value: 'java home' value: self javaHome value: true.
       
   420     dumper value: 'jre  home' value: self jreHome asString value: true.
       
   421     dumper value: 'class path' value: self classPath value: true.
       
   422     dumper value: 'boot class path' value: self bootClassPath value: true.
       
   423     dumper value: 'ext dirs' value: self javaExtDirs value: true.
       
   424 
       
   425 
       
   426     "
       
   427         Java release dumpConfigOn: Transcript.
       
   428     "
       
   429 
       
   430     "Created: / 10-12-2011 / 12:55:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   431 ! !
       
   432 
       
   433 !JavaRelease methodsFor:'displaying'!
       
   434 
       
   435 displayString
       
   436     ^self name
       
   437 
       
   438     "Created: / 27-07-2012 / 00:01:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   439 ! !
       
   440 
       
   441 !JavaRelease methodsFor:'initialization'!
       
   442 
       
   443 initialize
       
   444     self initializeBootClassPathIndex.
       
   445     self initializeExtDirsIndex.
       
   446     self initializeClassIndex.
       
   447 
       
   448     "Created: / 01-11-2011 / 14:09:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   449 !
       
   450 
       
   451 initializeBootClassPathIndex
       
   452     bootClassPathClasses := IdentitySet new.
       
   453     self bootClassPath do: [:file | 
       
   454         | filename |
       
   455 
       
   456         filename := file pathName.            
       
   457         
       
   458         self assert: (file suffix = 'jar').
       
   459         self assert: (file exists).
       
   460         self selectAllClassNamesIn: filename to: bootClassPathClasses.
       
   461     ].
       
   462 
       
   463     "Created: / 02-11-2011 / 12:12:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   464     "Modified: / 02-11-2011 / 23:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   465     "Modified: / 19-07-2012 / 11:02:41 / jv"
       
   466 !
       
   467 
       
   468 initializeClassIndex
       
   469     | jreHome |
       
   470 
       
   471     (jreHome := self jreHome) isNil ifTrue:[ ^ self ].
       
   472     classes := IdentitySet new.
       
   473 
       
   474     self jreHome recursiveDirectoryContents do: [
       
   475         :each | 
       
   476         (each endsWith: '.class') ifTrue: [
       
   477             classes add: each asSymbol.
       
   478         ].
       
   479         (each endsWith: '.jar') ifTrue: [ self selectAllClassNamesIn: (self jreHome asFilename / each asFilename) to: classes. ]
       
   480     ].
       
   481 
       
   482     "Created: / 01-11-2011 / 14:09:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   483     "Modified: / 27-07-2012 / 13:59:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   484 !
       
   485 
       
   486 initializeExtDirsIndex
       
   487     extDirsClasses := IdentitySet new.
       
   488     self javaExtDirs do: [
       
   489         :dir | 
       
   490         dir exists ifFalse: [
       
   491             Logger 
       
   492                 log: dir pathName 
       
   493                         , ', included in JavaRelease>>javaExtDirs, does not exist'
       
   494                 severity: #info
       
   495                 facility: 'JVM'
       
   496         ] ifTrue: [
       
   497             dir recursiveDirectoryContents do: [
       
   498                 :filename | 
       
   499                 (filename endsWith: '.class') ifTrue: [ extDirsClasses add: filename asSymbol ].
       
   500                 (filename endsWith: '.jar') ifTrue: [
       
   501                     self selectAllClassNamesIn: dir asFilename / filename asFilename to: extDirsClasses
       
   502                 ].
       
   503             ]
       
   504         ].
       
   505     ].
       
   506 
       
   507     "Created: / 02-11-2011 / 12:12:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   508 !
       
   509 
       
   510 selectAllClassNamesIn: jarArchiveName to: anIdentityCollection 
       
   511     | jar  classesInJar |
       
   512     jar := ZipArchive readingFrom: jarArchiveName asFilename readStream.
       
   513     classesInJar := jar entries select: [:each | each endsWith: '.class'. ].
       
   514     classesInJar do: [:each |         
       
   515         anIdentityCollection add: (each copyFrom: 1 to: each size - 6) asSymbol
       
   516     ].
       
   517 
       
   518     "
       
   519      JavaRelease any."
       
   520 
       
   521     "Created: / 02-11-2011 / 12:17:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   522     "Modified (format): / 02-11-2011 / 23:34:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   523 !
       
   524 
       
   525 updateClassIndexFrom: jarArchiveName 
       
   526     | jar  classesInJar |
       
   527     jar := ZipArchive 
       
   528                 readingFrom: (self jreHome asFilename / jarArchiveName asFilename) 
       
   529                         readStream.
       
   530     classesInJar := jar entries select: [:each | each endsWith: '.class'. ].
       
   531     classesInJar do: [:each | classes add: each asSymbol].
       
   532 
       
   533     "
       
   534      JavaRelease any."
       
   535 
       
   536     "Created: / 01-11-2011 / 14:18:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   537 ! !
       
   538 
       
   539 !JavaRelease methodsFor:'private'!
       
   540 
       
   541 searchInternalIndex: anIdentityCollection for: className 
       
   542     | classFileName |
       
   543     classFileName := (className asSlashedJavaClassName) asSymbol.
       
   544     ^ anIdentityCollection includes: classFileName asSymbol.
       
   545 
       
   546     "Created: / 02-11-2011 / 12:27:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   547 ! !
       
   548 
       
   549 !JavaRelease methodsFor:'queries'!
       
   550 
       
   551 bootClassPathIncludesClassNamed: className 
       
   552     ^ self searchInternalIndex: bootClassPathClasses for: className.
       
   553 
       
   554     "Created: / 02-11-2011 / 12:11:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   555 !
       
   556 
       
   557 extDirsIncludesClassNamed: className 
       
   558     ^self searchInternalIndex: classes for: className.
       
   559 
       
   560     "Created: / 02-11-2011 / 12:11:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   561 !
       
   562 
       
   563 includesClassNamed: className 
       
   564     self searchInternalIndex: classes for: className.
       
   565 
       
   566     "Created: / 01-11-2011 / 14:50:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   567 !
       
   568 
       
   569 isAvailable
       
   570 
       
   571     ^self javaHomeOrNil notNil
       
   572 
       
   573     "
       
   574         JavaRelease openJDK6 isAvailable 
       
   575         JavaRelease sunJDK6 isAvailable  
       
   576 
       
   577     "
       
   578 
       
   579     "Created: / 22-11-2010 / 13:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   580 !
       
   581 
       
   582 isCustom
       
   583     ^false
       
   584 
       
   585     "Created: / 27-07-2012 / 00:08:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   586 ! !
       
   587 
       
   588 !JavaRelease methodsFor:'searching'!
       
   589 
       
   590 searchForClassPath
       
   591 
       
   592     | jreHome   |
       
   593     classPath := OrderedCollection new.
       
   594     jreHome := self jreHome.
       
   595     "Ensure, that rt.jar is first"
       
   596     classPath add: (JavaPathElement newFromRelease:(jreHome / 'lib' / 'rt.jar') asString).
       
   597 
       
   598     self searchForClassPathIn: jreHome / 'lib' .
       
   599     self searchForClassPathIn: jreHome / 'lib' / 'modules'.
       
   600 
       
   601     ^self classPath
       
   602 
       
   603     "
       
   604         Java release searchForClassPath.
       
   605         Java release classPath.
       
   606     
       
   607     "
       
   608 
       
   609     "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   610 !
       
   611 
       
   612 searchForClassPathIn: dir 
       
   613     dir exists ifFalse: [ ^ self ].
       
   614     dir directoryContentsAsFilenames do: [
       
   615         :file | 
       
   616         " this is to make sure that rt.jar is always first --v     "
       
   617         (file suffix = 'jar' and: [ file baseName ~= 'rt.jar' ]) ifTrue: [
       
   618             classPath add: (JavaPathElement newFromRelease:file asString)
       
   619         ]
       
   620     ]
       
   621 
       
   622     "Created: / 27-10-2010 / 21:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   623     "Modified: / 02-11-2011 / 17:49:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   624     "Modified: / 27-07-2012 / 11:45:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   625 !
       
   626 
       
   627 searchForJavaHome
       
   628 
       
   629     | h |
       
   630 
       
   631     h := (OperatingSystem getEnvironment:'JAVA_HOME').
       
   632     h notNil ifTrue:[
       
   633         javaHome := h  asFilename.
       
   634         "/Do not trust JAVA_HOME, it might be wrong (on Windows machine due
       
   635         "/to a registry mess
       
   636         javaHome exists ifTrue:[
       
   637             (javaHome / 'jre') exists ifTrue:[
       
   638                 javaHome := javaHome / 'jre'.
       
   639             ].
       
   640             ^javaHome
       
   641         ]
       
   642     ].
       
   643 
       
   644     self javaHomes do:
       
   645         [:home| | homeAsFilename |
       
   646         homeAsFilename := home asFilename.
       
   647         homeAsFilename exists ifTrue:
       
   648             [(self validateJavaHome: homeAsFilename) ifTrue:
       
   649                 [^javaHome := home]]].
       
   650 
       
   651     ^nil
       
   652 
       
   653     "Created: / 27-10-2010 / 19:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   654     "Modified: / 22-11-2010 / 13:18:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   655     "Modified: / 15-03-2011 / 13:29:14 / Jan Kurs <kursjan@fit.cvut.cz>"
       
   656     "Modified: / 15-03-2011 / 13:47:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   657     "Modified: / 19-07-2012 / 11:08:04 / jv"
       
   658 !
       
   659 
       
   660 searchForSourcePath
       
   661 
       
   662     | src_zip |
       
   663 
       
   664     sourcePath := OrderedCollection new.
       
   665     src_zip := self javaHome asFilename directory / 'src.zip'.
       
   666     src_zip exists ifTrue:[sourcePath add: (JavaPathElement newFromRelease:src_zip asString)].
       
   667 
       
   668     "
       
   669         JavaRelease openJDK6 searchForSourcePath; sourcePath      
       
   670     "
       
   671 
       
   672     "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   673     "Modified: / 27-07-2012 / 11:45:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   674 ! !
       
   675 
       
   676 !JavaRelease methodsFor:'validating'!
       
   677 
       
   678 validateJavaHome: home
       
   679 
       
   680     "Just JRE"
       
   681     ( home  asFilename / 'lib' / 'rt.jar' ) exists ifTrue:[^true].
       
   682 
       
   683     "Full JDK"
       
   684     ( home asFilename / 'jre' / 'lib' / 'rt.jar' ) exists ifTrue:[^true].
       
   685     
       
   686     ^ false
       
   687 
       
   688     "
       
   689         JavaRelease basicNew validateJavaHome: '/usr/lib/jvm/java-6-openjdk'  
       
   690         JavaRelease basicNew validateJavaHome: '/tmp'               
       
   691     "
       
   692 
       
   693     "Created: / 27-10-2010 / 19:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   694     "Modified: / 27-10-2010 / 21:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   695 ! !
       
   696 
       
   697 !JavaRelease::Custom class methodsFor:'documentation'!
       
   698 
       
   699 copyright
       
   700 "
       
   701  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
   702 
       
   703  New code and modifications done at SWING Research Group [1]:
       
   704 
       
   705  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
   706                             SWING Research Group, Czech Technical University in Prague
       
   707 
       
   708  This software is furnished under a license and may be used
       
   709  only in accordance with the terms of that license and with the
       
   710  inclusion of the above copyright notice.   This software may not
       
   711  be provided or otherwise made available to, or used by, any
       
   712  other person.  No title to or ownership of the software is
       
   713  hereby transferred.
       
   714 
       
   715  [1] Code written at SWING Research Group contains a signature
       
   716      of one of the above copright owners. For exact set of such code,
       
   717      see the differences between this version and version stx:libjava
       
   718      as of 1.9.2010
       
   719 
       
   720 "
       
   721 !
       
   722 
       
   723 version_SVN
       
   724     ^ '$Id::                                                                                                                        $'
       
   725 ! !
       
   726 
       
   727 !JavaRelease::Custom methodsFor:'accessing'!
       
   728 
       
   729 bootClassPathOnUNIX
       
   730     "superclass JavaRelease says that I am responsible to implement this method"
       
   731 
       
   732     ^ self shouldImplement
       
   733 !
       
   734 
       
   735 bootClassPathOnWindows
       
   736     "superclass JavaRelease says that I am responsible to implement this method"
       
   737 
       
   738     ^ self shouldImplement
       
   739 !
       
   740 
       
   741 javaHome
       
   742 
       
   743     "Answer a Java home"
       
   744 
       
   745     javaHome isNil ifTrue:[
       
   746         javaHome := OperatingSystem getEnvironment:'JAVA_HOME'.
       
   747     ].
       
   748     ^javaHome
       
   749 
       
   750     "
       
   751         JavaRelease custom javaHome
       
   752     "
       
   753 
       
   754     "Created: / 26-07-2012 / 23:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   755 !
       
   756 
       
   757 javaHome: aString
       
   758      javaHome := aString 
       
   759 
       
   760     "
       
   761         JavaRelease openJDK6 javaHome
       
   762     "
       
   763 
       
   764     "Created: / 26-07-2012 / 23:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   765 !
       
   766 
       
   767 javaHomesOnUNIX
       
   768     "raise an error: must be redefined in concrete subclass(es)"
       
   769 
       
   770     ^ self shouldNotImplement
       
   771 
       
   772     "Modified: / 27-07-2012 / 00:02:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   773 !
       
   774 
       
   775 javaHomesOnWindows
       
   776     "raise an error: must be redefined in concrete subclass(es)"
       
   777 
       
   778     ^ self shouldNotImplement
       
   779 
       
   780     "Modified: / 27-07-2012 / 00:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   781 !
       
   782 
       
   783 name
       
   784     "superclass JavaRelease says that I am responsible to implement this method"
       
   785 
       
   786     ^ 'Custom'
       
   787 
       
   788     "Modified: / 27-07-2012 / 00:02:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   789 !
       
   790 
       
   791 priority
       
   792 
       
   793     ^1
       
   794 
       
   795     "Created: / 26-07-2012 / 23:38:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   796 !
       
   797 
       
   798 selector
       
   799     "Returns instance-creation selector to get the receiver.
       
   800      See JavaRelease class, protocol instance creation"
       
   801 
       
   802     ^#custom
       
   803 
       
   804     "Created: / 27-07-2012 / 10:04:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   805 ! !
       
   806 
       
   807 !JavaRelease::Custom methodsFor:'initialization'!
       
   808 
       
   809 initialize
       
   810     "Initialize lazily in javaHome:"
       
   811 
       
   812     "Created: / 26-07-2012 / 23:40:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   813 ! !
       
   814 
       
   815 !JavaRelease::Custom methodsFor:'queries'!
       
   816 
       
   817 isAvailable
       
   818     ^true
       
   819 
       
   820     "Created: / 26-07-2012 / 23:35:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   821 !
       
   822 
       
   823 isCustom
       
   824     ^true
       
   825 
       
   826     "Created: / 27-07-2012 / 00:08:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   827 ! !
       
   828 
       
   829 !JavaRelease::Custom methodsFor:'searching'!
       
   830 
       
   831 searchForJavaHome
       
   832     self shouldNotImplement
       
   833 
       
   834     "Created: / 26-07-2012 / 23:34:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   835 ! !
       
   836 
       
   837 !JavaRelease::OpenJDK6 class methodsFor:'documentation'!
       
   838 
       
   839 copyright
       
   840 "
       
   841  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
   842 
       
   843  New code and modifications done at SWING Research Group [1]:
       
   844 
       
   845  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
   846                             SWING Research Group, Czech Technical University in Prague
       
   847 
       
   848  This software is furnished under a license and may be used
       
   849  only in accordance with the terms of that license and with the
       
   850  inclusion of the above copyright notice.   This software may not
       
   851  be provided or otherwise made available to, or used by, any
       
   852  other person.  No title to or ownership of the software is
       
   853  hereby transferred.
       
   854 
       
   855  [1] Code written at SWING Research Group contains a signature
       
   856      of one of the above copright owners. For exact set of such code,
       
   857      see the differences between this version and version stx:libjava
       
   858      as of 1.9.2010
       
   859 
       
   860 "
       
   861 !
       
   862 
       
   863 version_SVN
       
   864     ^ '$Id::                                                                                                                        $'
       
   865 ! !
       
   866 
       
   867 !JavaRelease::OpenJDK6 methodsFor:'accessing'!
       
   868 
       
   869 bootClassPathOnUNIX
       
   870 
       
   871     | jre |
       
   872     jre := self jreHome.
       
   873 
       
   874     ^ {
       
   875             jre / 'lib' / 'resources.jar' .
       
   876             jre / 'lib' / 'rt.jar' .
       
   877             jre / 'lib' / 'jsse.jar' .
       
   878             jre / 'lib' / 'jce.jar' .
       
   879             jre / 'lib' / 'charsets.jar' .
       
   880     }
       
   881 
       
   882     "
       
   883         JavaRelease openJDK6 bootClassPathOnUNIX
       
   884     "
       
   885 
       
   886     "Created: / 02-11-2011 / 12:36:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   887     "Modified (comment): / 02-11-2011 / 23:39:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   888 !
       
   889 
       
   890 bootClassPathOnWindows
       
   891 
       
   892     "This should be the same as on UNIX, we'll see..."
       
   893 
       
   894     ^self bootClassPathOnUNIX
       
   895 
       
   896     "Created: / 02-11-2011 / 12:36:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
       
   897     "Created: / 02-11-2011 / 23:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   898 !
       
   899 
       
   900 javaExtDirsOnUNIX
       
   901 
       
   902     ^{
       
   903         self javaHome asFilename / 'lib' / 'ext' .
       
   904         '/usr/java/packages/lib/ext' asFilename
       
   905     }
       
   906 
       
   907     "Created: / 31-08-2011 / 20:01:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   908 !
       
   909 
       
   910 javaExtDirsOnWindows
       
   911 
       
   912     ^{
       
   913         self javaHome asFilename / 'lib' / 'ext' .
       
   914     }
       
   915 
       
   916     "Created: / 31-08-2011 / 20:02:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   917 !
       
   918 
       
   919 javaHomesOnUNIX
       
   920     ^ #( '/usr/lib/jvm/java-6-openjdk/jre' )
       
   921 
       
   922     "Modified: / 07-08-2011 / 20:38:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   923 !
       
   924 
       
   925 name
       
   926     "superclass JavaRelease says that I am responsible to implement this method"
       
   927 
       
   928     ^ 'Open JDK 6'
       
   929 
       
   930     "Modified: / 27-10-2010 / 19:16:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   931 !
       
   932 
       
   933 priority
       
   934 
       
   935     ^80
       
   936     "/^70
       
   937 
       
   938     "Created: / 22-11-2010 / 13:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   939     "Modified: / 04-02-2011 / 06:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   940 !
       
   941 
       
   942 selector
       
   943     "Returns instance-creation selector to get the receiver.
       
   944      See JavaRelease class, protocol instance creation"
       
   945 
       
   946     ^#openJDK6
       
   947 
       
   948     "Created: / 27-07-2012 / 10:05:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   949 ! !
       
   950 
       
   951 !JavaRelease::OpenJDK6 methodsFor:'private'!
       
   952 
       
   953 javaHomeOnWindowsJDKDirectoryPrefix
       
   954     ^'jdk1.6'
       
   955 
       
   956     "Created: / 19-07-2012 / 11:04:34 / jv"
       
   957 ! !
       
   958 
       
   959 !JavaRelease::OpenJDK7 class methodsFor:'documentation'!
       
   960 
       
   961 copyright
       
   962 "
       
   963  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
   964 
       
   965  New code and modifications done at SWING Research Group [1]:
       
   966 
       
   967  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
   968                             SWING Research Group, Czech Technical University in Prague
       
   969 
       
   970  This software is furnished under a license and may be used
       
   971  only in accordance with the terms of that license and with the
       
   972  inclusion of the above copyright notice.   This software may not
       
   973  be provided or otherwise made available to, or used by, any
       
   974  other person.  No title to or ownership of the software is
       
   975  hereby transferred.
       
   976 
       
   977  [1] Code written at SWING Research Group contains a signature
       
   978      of one of the above copright owners. For exact set of such code,
       
   979      see the differences between this version and version stx:libjava
       
   980      as of 1.9.2010
       
   981 
       
   982 "
       
   983 !
       
   984 
       
   985 version_SVN
       
   986     ^ '$Id::                                                                                                                        $'
       
   987 ! !
       
   988 
       
   989 !JavaRelease::OpenJDK7 methodsFor:'accessing'!
       
   990 
       
   991 javaHomesOnUNIX
       
   992     | arch |
       
   993 
       
   994     arch := OperatingSystem getSystemInfo at:#machine.
       
   995     arch = 'x86_64' ifTrue:[arch := 'amd64'].
       
   996 
       
   997     ^ { '/usr/lib/jvm/java-7-openjdk/jre'  .
       
   998       '/usr/lib/jvm/java-7-openjdk-',arch,'/jre' }
       
   999 
       
  1000     "
       
  1001     JavaRelease::OpenJDK7 new javaHomesOnUNIX
       
  1002     "
       
  1003 
       
  1004     "Created: / 11-02-2012 / 17:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1005 !
       
  1006 
       
  1007 name
       
  1008     ^ 'OpenJDK7 (not yet supported)'
       
  1009 
       
  1010     "Created: / 27-07-2012 / 00:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1011 !
       
  1012 
       
  1013 priority
       
  1014 
       
  1015     ^ super priority - 10
       
  1016     "/^70
       
  1017 
       
  1018     "Modified: / 04-02-2011 / 06:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1019     "Created: / 11-02-2012 / 17:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1020 !
       
  1021 
       
  1022 selector
       
  1023     "Returns instance-creation selector to get the receiver.
       
  1024      See JavaRelease class, protocol instance creation"
       
  1025 
       
  1026     ^#openJDK7
       
  1027 
       
  1028     "Created: / 27-07-2012 / 10:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1029 ! !
       
  1030 
       
  1031 !JavaRelease::OpenJDK7 methodsFor:'private'!
       
  1032 
       
  1033 javaHomeOnWindowsJDKDirectoryPrefix
       
  1034     ^'jdk1.7'
       
  1035 
       
  1036     "Created: / 19-07-2012 / 11:05:02 / jv"
       
  1037 ! !
       
  1038 
       
  1039 !JavaRelease::SunJDK122 class methodsFor:'documentation'!
       
  1040 
       
  1041 copyright
       
  1042 "
       
  1043  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
  1044 
       
  1045  New code and modifications done at SWING Research Group [1]:
       
  1046 
       
  1047  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
  1048                             SWING Research Group, Czech Technical University in Prague
       
  1049 
       
  1050  This software is furnished under a license and may be used
       
  1051  only in accordance with the terms of that license and with the
       
  1052  inclusion of the above copyright notice.   This software may not
       
  1053  be provided or otherwise made available to, or used by, any
       
  1054  other person.  No title to or ownership of the software is
       
  1055  hereby transferred.
       
  1056 
       
  1057  [1] Code written at SWING Research Group contains a signature
       
  1058      of one of the above copright owners. For exact set of such code,
       
  1059      see the differences between this version and version stx:libjava
       
  1060      as of 1.9.2010
       
  1061 
       
  1062 "
       
  1063 !
       
  1064 
       
  1065 version_SVN
       
  1066     ^ '$Id::                                                                                                                        $'
       
  1067 ! !
       
  1068 
       
  1069 !JavaRelease::SunJDK122 methodsFor:'accessing'!
       
  1070 
       
  1071 javaHomesOnUNIX
       
  1072     "superclass JavaRelease says that I am responsible to implement this method"
       
  1073 
       
  1074     ^#(
       
  1075             '/home/jv/Projects/JavaX/jdk1.2.2' "/On Jan Vrany's machine :-)
       
  1076         )
       
  1077 
       
  1078     "Created: / 22-11-2010 / 13:26:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1079 !
       
  1080 
       
  1081 javaHomesOnWindows
       
  1082 
       
  1083 	^ #()
       
  1084 
       
  1085 !
       
  1086 
       
  1087 name
       
  1088     "superclass JavaRelease says that I am responsible to implement this method"
       
  1089 
       
  1090     ^ 'Sun JDK 1.2.2'
       
  1091 
       
  1092     "Modified: / 27-07-2012 / 00:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1093 !
       
  1094 
       
  1095 priority
       
  1096 
       
  1097     ^10
       
  1098 
       
  1099     "Created: / 22-11-2010 / 13:34:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1100 !
       
  1101 
       
  1102 selector
       
  1103     "Returns instance-creation selector to get the receiver.
       
  1104      See JavaRelease class, protocol instance creation"
       
  1105 
       
  1106     ^#sunJDK122
       
  1107 
       
  1108     "Created: / 27-07-2012 / 10:06:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1109 ! !
       
  1110 
       
  1111 !JavaRelease::SunJDK122 methodsFor:'displaying'!
       
  1112 
       
  1113 displayString
       
  1114 
       
  1115     ^self isAvailable ifTrue:[
       
  1116         self name
       
  1117     ] ifFalse:[
       
  1118         (self name , ' ' , '(not available)') asText colorizeAllWith: Color gray
       
  1119     ]
       
  1120 
       
  1121     "Created: / 27-07-2012 / 00:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1122 ! !
       
  1123 
       
  1124 !JavaRelease::SunJDK122 methodsFor:'queries'!
       
  1125 
       
  1126 isAvailable
       
  1127     "We don't really support it"
       
  1128 
       
  1129     ^false
       
  1130 
       
  1131     "Created: / 27-07-2012 / 00:04:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1132 ! !
       
  1133 
       
  1134 !JavaRelease::SunJDK6 class methodsFor:'documentation'!
       
  1135 
       
  1136 copyright
       
  1137 "
       
  1138  COPYRIGHT (c) 1996-2011 by Claus Gittinger
       
  1139 
       
  1140  New code and modifications done at SWING Research Group [1]:
       
  1141 
       
  1142  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
       
  1143                             SWING Research Group, Czech Technical University in Prague
       
  1144 
       
  1145  This software is furnished under a license and may be used
       
  1146  only in accordance with the terms of that license and with the
       
  1147  inclusion of the above copyright notice.   This software may not
       
  1148  be provided or otherwise made available to, or used by, any
       
  1149  other person.  No title to or ownership of the software is
       
  1150  hereby transferred.
       
  1151 
       
  1152  [1] Code written at SWING Research Group contains a signature
       
  1153      of one of the above copright owners. For exact set of such code,
       
  1154      see the differences between this version and version stx:libjava
       
  1155      as of 1.9.2010
       
  1156 
       
  1157 "
       
  1158 !
       
  1159 
       
  1160 version_SVN
       
  1161     ^ '$Id::                                                                                                                        $'
       
  1162 ! !
       
  1163 
       
  1164 !JavaRelease::SunJDK6 methodsFor:'accessing'!
       
  1165 
       
  1166 javaHomesOnUNIX
       
  1167 
       
  1168     ^ #( '/usr/lib/jvm/java-6-sun' )
       
  1169 
       
  1170     "Created: / 22-11-2010 / 13:31:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1171 !
       
  1172 
       
  1173 javaHomesOnWindows
       
  1174     |entry vsn home paths |
       
  1175 
       
  1176     entry := (OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit').
       
  1177     entry notNil ifTrue:[
       
  1178         vsn := entry valueNamed:'CurrentVersion'.
       
  1179     ].
       
  1180     vsn notNil ifTrue:[
       
  1181         entry := (OperatingSystem registryEntry
       
  1182                     key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\',vsn).
       
  1183         home := entry valueNamed:'JavaHome'.
       
  1184         home notNil ifTrue:[
       
  1185             ^ (Array with:(home,'\jre'))
       
  1186         ].
       
  1187     ].
       
  1188     paths := OrderedCollection new.
       
  1189     #(
       
  1190         'C:\Program Files\Java'
       
  1191         'C:\Program Files (x86)\Java' 
       
  1192     ) do:[:rootpath|
       
  1193         | root |
       
  1194 
       
  1195         root := rootpath asFilename.
       
  1196         root exists ifTrue:[
       
  1197             root directoryContents do:[:dir|
       
  1198                 (dir startsWith:self javaHomeOnWindowsJDKDirectoryPrefix) ifTrue:[
       
  1199                     | path |    
       
  1200                     (path := root / dir / 'jre') isDirectory ifTrue:[
       
  1201                         paths add: path
       
  1202                     ].
       
  1203                 ].
       
  1204             ]
       
  1205         ]
       
  1206     ].
       
  1207 
       
  1208     ^ paths
       
  1209 
       
  1210     "
       
  1211      self basicNew javaHomesOnWindows
       
  1212     "
       
  1213 
       
  1214     "Modified: / 07-08-2011 / 20:38:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1215     "Modified (format): / 19-08-2011 / 00:46:40 / cg"
       
  1216     "Modified: / 19-07-2012 / 11:04:44 / jv"
       
  1217 !
       
  1218 
       
  1219 name
       
  1220 
       
  1221     ^ 'Sun JDK 6'
       
  1222 
       
  1223     "Created: / 22-11-2010 / 13:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1224 !
       
  1225 
       
  1226 priority
       
  1227 
       
  1228     "/There is no OpenJDK 6 for Windows yet...
       
  1229     OperatingSystem isMSWINDOWSlike ifTrue:[
       
  1230         ^100
       
  1231     ].
       
  1232     ^75
       
  1233 
       
  1234     "Created: / 22-11-2010 / 13:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1235     "Modified: / 19-07-2012 / 10:57:55 / jv"
       
  1236 !
       
  1237 
       
  1238 selector
       
  1239     "Returns instance-creation selector to get the receiver.
       
  1240      See JavaRelease class, protocol instance creation"
       
  1241 
       
  1242     ^#sunJDK6
       
  1243 
       
  1244     "Created: / 27-07-2012 / 10:05:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1245 ! !
       
  1246 
       
  1247 !JavaRelease class methodsFor:'documentation'!
       
  1248 
       
  1249 version_SVN
       
  1250 
       
  1251     ^ '$Id$'
       
  1252 
       
  1253 ! !