--- a/src/JavaRelease.st Mon Jul 30 23:57:25 2012 +0000
+++ b/src/JavaRelease.st Tue Jul 31 09:18:43 2012 +0000
@@ -1,1253 +0,0 @@
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-"
-"{ Package: 'stx:libjava' }"
-
-Object subclass:#JavaRelease
- instanceVariableNames:'javaHome classPath sourcePath classes bootClassPathClasses
- extDirsClasses'
- classVariableNames:''
- poolDictionaries:''
- category:'Languages-Java-Support'
-!
-
-JavaRelease class instanceVariableNames:'instance'
-
-"
- No other class instance variables are inherited by this class.
-"
-!
-
-JavaRelease subclass:#Custom
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:JavaRelease
-!
-
-JavaRelease subclass:#OpenJDK6
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:JavaRelease
-!
-
-JavaRelease::OpenJDK6 subclass:#OpenJDK7
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:JavaRelease
-!
-
-JavaRelease subclass:#SunJDK122
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:JavaRelease
-!
-
-JavaRelease::OpenJDK6 subclass:#SunJDK6
- instanceVariableNames:''
- classVariableNames:''
- poolDictionaries:''
- privateIn:JavaRelease
-!
-
-!JavaRelease class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-
-"
-! !
-
-!JavaRelease class methodsFor:'instance creation'!
-
-custom
- ^Custom instance
-
- "Created: / 26-07-2012 / 23:37:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-openJDK6
- ^ OpenJDK6 instance
-
- "Created: / 27-10-2010 / 21:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 05-11-2011 / 18:45:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 27-07-2012 / 00:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-openJDK7
- ^ OpenJDK7 instance.
-
- "Created: / 26-07-2012 / 23:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-sunJDK122
- ^ SunJDK122 instance
-
- "Created: / 27-10-2010 / 21:41:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 05-11-2011 / 18:45:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 27-07-2012 / 00:22:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-sunJDK6
- ^ SunJDK6 instance
-
- "Created: / 22-11-2010 / 13:33:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 05-11-2011 / 18:45:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 27-07-2012 / 00:22:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease class methodsFor:'accessing'!
-
-all
- ^(self allSubclasses
- reject: [:rel | rel isAbstract ]
- thenCollect: [:rel | rel instance ])
- asSortedCollection: [:a :b | a priority > b priority ]
-
-
- "
- JavaRelease all
- "
-
- "Created: / 27-07-2012 / 00:10:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-any
- | releases |
-
- releases := self available.
- releases isEmptyOrNil ifTrue:[ ^ nil ].
- ^ releases first initialize
-
-
- "
- JavaRelease any
- "
-
- "Created: / 22-11-2010 / 13:11:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 01-11-2011 / 14:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 26-07-2012 / 23:42:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-available
- | releases |
- releases := self all select: [:rel | rel isAvailable ].
- releases isEmpty
- ifTrue: [ self error: 'No Java release found'. ^nil ].
- ^releases
-
- "
- JavaRelease available
- "
-
- "Created: / 26-07-2012 / 23:41:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease class methodsFor:'instance creation-private'!
-
-instance
- instance isNil ifTrue:[
- instance := self new initialize
- ].
- ^instance
-
- "Created: / 27-07-2012 / 00:22:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease class methodsFor:'queries'!
-
-isAbstract
-
- ^self class == JavaRelease
-
- "Created: / 22-11-2010 / 13:33:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'accessing'!
-
-bootClassPath
- "Returns a default value of sun.boot.class.path"
-
- OperatingSystem isUNIXlike ifTrue: [ ^ self bootClassPathOnUNIX ].
- OperatingSystem isMSWINDOWSlike ifTrue: [ ^ self bootClassPathOnWindows ].
- self error: 'Unsupported platform'.
- ^ #().
-
- "Created: / 02-11-2011 / 12:19:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-bootClassPathOnUNIX
- "Not known..."
- ^#()
-
- "Created: / 02-11-2011 / 12:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 27-07-2012 / 00:23:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-bootClassPathOnWindows
- self subclassResponsibility.
-
- "Created: / 02-11-2011 / 12:33:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-classPath
-
- "Returns a default class path"
-
- classPath ifNil:[self searchForClassPath].
- ^classPath
-
- "
- JavaRelease openJDK6 classPath
- "
-
- "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-10-2010 / 21:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaExtDirs
-
- "Returns a default value of java.ext.dirs property"
-
- OperatingSystem isUNIXlike ifTrue:[ ^ self javaExtDirsOnUNIX ].
- OperatingSystem isMSWINDOWSlike ifTrue:[ ^ self javaExtDirsOnWindows ].
- self error:'Unsupported platform'.
- ^ #()
-
-
- "
- JavaRelease openJDK6 classPath
- "
-
- "Modified: / 27-10-2010 / 21:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Created: / 31-08-2011 / 19:59:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaExtDirsOnUNIX
-
- ^#()
-
- "Created: / 31-08-2011 / 19:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaExtDirsOnWindows
-
- ^#()
-
- "Created: / 31-08-2011 / 19:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHome
-
- "Answer a Java home"
-
- javaHome isNil ifTrue:[
- javaHome := self searchForJavaHome.
- ].
- ^javaHome
-
- "
- JavaRelease openJDK6 javaHome
- "
-
- "Created: / 27-10-2010 / 18:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-07-2012 / 00:24:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomeOrNil
-
- "Answer a Java home"
-
- | home |
- home := (javaHome
- ifNotNil:[javaHome]
- ifNil:[self searchForJavaHome]).
- ^home
-
- "
- JavaRelease openJDK6 javaHome
- "
-
- "Created: / 22-11-2010 / 13:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomes
-
- "Answer a set of possible java homes, those directories are searched"
-
-
- OperatingSystem isUNIXlike ifTrue:[ ^ self javaHomesOnUNIX ].
- OperatingSystem isMSWINDOWSlike ifTrue:[ ^ self javaHomesOnWindows ].
- self error:'Unsupported platform'.
- ^ #()
-
- "Modified: / 22-11-2010 / 13:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomesOnUNIX
- "raise an error: must be redefined in concrete subclass(es)"
-
- ^ self subclassResponsibility
-!
-
-javaHomesOnWindows
- "raise an error: must be redefined in concrete subclass(es)"
-
- ^ self subclassResponsibility
-!
-
-jreHome
-
- "Answers the directory where the JRE lives"
-
- | jreHome |
-
- self javaHome isNil ifTrue:[ ^ nil ].
-
- ^(jreHome := self javaHome asFilename / 'jre') exists
- ifTrue:[jreHome]
- ifFalse:[javaHome asFilename].
-
- "Created: / 27-10-2010 / 21:24:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-name
-
- "Answer a human readable name of the Java release such as Sun JDK 1.2.2 or OpenJDK 6"
-
- ^self subclassResponsibility
-
- "Created: / 27-10-2010 / 18:53:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-priority
-
- ^50
-
- "Created: / 22-11-2010 / 13:34:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-selector
- "Returns instance-creation selector to get the receiver.
- See JavaRelease class, protocol instance creation"
-
- ^self subclassResponsibility
-
- "Created: / 27-07-2012 / 10:04:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-sourcePath
-
- "Returns a paths where sources are located"
-
- sourcePath ifNil:[self searchForSourcePath].
- ^sourcePath
-
- "
- JavaRelease openJDK6 sourcePath
- "
-
- "Created: / 27-10-2010 / 19:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 30-11-2010 / 11:55:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'debugging'!
-
-dumpConfigOn: stream
-
- | dumper |
- dumper := [:name :value :isfile|
- | values |
-
- '%-15s : ' printf:{ name } on: stream.
- value isString
- ifTrue:[values := { value asString }]
- ifFalse:[values := value].
- values do:[:v|
- stream nextPutAll: v asString.
- isfile ifTrue:[
- v asFilename exists ifFalse:[
- stream nextPutAll:' (not found!!!!!!)'
- ].
- ]
- ] separatedBy:[stream cr; next: 15 + 3 put: Character space].
- stream cr.
- ].
-
-
-
- stream nextPutAll: '== Java release config =='; cr.
- dumper value: 'name' value: self name value: false.
- dumper value: 'java home' value: self javaHome value: true.
- dumper value: 'jre home' value: self jreHome asString value: true.
- dumper value: 'class path' value: self classPath value: true.
- dumper value: 'boot class path' value: self bootClassPath value: true.
- dumper value: 'ext dirs' value: self javaExtDirs value: true.
-
-
- "
- Java release dumpConfigOn: Transcript.
- "
-
- "Created: / 10-12-2011 / 12:55:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'displaying'!
-
-displayString
- ^self name
-
- "Created: / 27-07-2012 / 00:01:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'initialization'!
-
-initialize
- self initializeBootClassPathIndex.
- self initializeExtDirsIndex.
- self initializeClassIndex.
-
- "Created: / 01-11-2011 / 14:09:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-initializeBootClassPathIndex
- bootClassPathClasses := IdentitySet new.
- self bootClassPath do: [:file |
- | filename |
-
- filename := file pathName.
-
- self assert: (file suffix = 'jar').
- self assert: (file exists).
- self selectAllClassNamesIn: filename to: bootClassPathClasses.
- ].
-
- "Created: / 02-11-2011 / 12:12:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 02-11-2011 / 23:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-07-2012 / 11:02:41 / jv"
-!
-
-initializeClassIndex
- | jreHome |
-
- (jreHome := self jreHome) isNil ifTrue:[ ^ self ].
- classes := IdentitySet new.
-
- self jreHome recursiveDirectoryContents do: [
- :each |
- (each endsWith: '.class') ifTrue: [
- classes add: each asSymbol.
- ].
- (each endsWith: '.jar') ifTrue: [ self selectAllClassNamesIn: (self jreHome asFilename / each asFilename) to: classes. ]
- ].
-
- "Created: / 01-11-2011 / 14:09:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 27-07-2012 / 13:59:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-initializeExtDirsIndex
- extDirsClasses := IdentitySet new.
- self javaExtDirs do: [
- :dir |
- dir exists ifFalse: [
- Logger
- log: dir pathName
- , ', included in JavaRelease>>javaExtDirs, does not exist'
- severity: #info
- facility: 'JVM'
- ] ifTrue: [
- dir recursiveDirectoryContents do: [
- :filename |
- (filename endsWith: '.class') ifTrue: [ extDirsClasses add: filename asSymbol ].
- (filename endsWith: '.jar') ifTrue: [
- self selectAllClassNamesIn: dir asFilename / filename asFilename to: extDirsClasses
- ].
- ]
- ].
- ].
-
- "Created: / 02-11-2011 / 12:12:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-selectAllClassNamesIn: jarArchiveName to: anIdentityCollection
- | jar classesInJar |
- jar := ZipArchive readingFrom: jarArchiveName asFilename readStream.
- classesInJar := jar entries select: [:each | each endsWith: '.class'. ].
- classesInJar do: [:each |
- anIdentityCollection add: (each copyFrom: 1 to: each size - 6) asSymbol
- ].
-
- "
- JavaRelease any."
-
- "Created: / 02-11-2011 / 12:17:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified (format): / 02-11-2011 / 23:34:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-updateClassIndexFrom: jarArchiveName
- | jar classesInJar |
- jar := ZipArchive
- readingFrom: (self jreHome asFilename / jarArchiveName asFilename)
- readStream.
- classesInJar := jar entries select: [:each | each endsWith: '.class'. ].
- classesInJar do: [:each | classes add: each asSymbol].
-
- "
- JavaRelease any."
-
- "Created: / 01-11-2011 / 14:18:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'private'!
-
-searchInternalIndex: anIdentityCollection for: className
- | classFileName |
- classFileName := (className asSlashedJavaClassName) asSymbol.
- ^ anIdentityCollection includes: classFileName asSymbol.
-
- "Created: / 02-11-2011 / 12:27:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'queries'!
-
-bootClassPathIncludesClassNamed: className
- ^ self searchInternalIndex: bootClassPathClasses for: className.
-
- "Created: / 02-11-2011 / 12:11:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-extDirsIncludesClassNamed: className
- ^self searchInternalIndex: classes for: className.
-
- "Created: / 02-11-2011 / 12:11:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-includesClassNamed: className
- self searchInternalIndex: classes for: className.
-
- "Created: / 01-11-2011 / 14:50:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-isAvailable
-
- ^self javaHomeOrNil notNil
-
- "
- JavaRelease openJDK6 isAvailable
- JavaRelease sunJDK6 isAvailable
-
- "
-
- "Created: / 22-11-2010 / 13:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-isCustom
- ^false
-
- "Created: / 27-07-2012 / 00:08:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'searching'!
-
-searchForClassPath
-
- | jreHome |
- classPath := OrderedCollection new.
- jreHome := self jreHome.
- "Ensure, that rt.jar is first"
- classPath add: (JavaPathElement newFromRelease:(jreHome / 'lib' / 'rt.jar') asString).
-
- self searchForClassPathIn: jreHome / 'lib' .
- self searchForClassPathIn: jreHome / 'lib' / 'modules'.
-
- ^self classPath
-
- "
- Java release searchForClassPath.
- Java release classPath.
-
- "
-
- "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-searchForClassPathIn: dir
- dir exists ifFalse: [ ^ self ].
- dir directoryContentsAsFilenames do: [
- :file |
- " this is to make sure that rt.jar is always first --v "
- (file suffix = 'jar' and: [ file baseName ~= 'rt.jar' ]) ifTrue: [
- classPath add: (JavaPathElement newFromRelease:file asString)
- ]
- ]
-
- "Created: / 27-10-2010 / 21:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-11-2011 / 17:49:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 27-07-2012 / 11:45:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-searchForJavaHome
-
- | h |
-
- h := (OperatingSystem getEnvironment:'JAVA_HOME').
- h notNil ifTrue:[
- javaHome := h asFilename.
- "/Do not trust JAVA_HOME, it might be wrong (on Windows machine due
- "/to a registry mess
- javaHome exists ifTrue:[
- (javaHome / 'jre') exists ifTrue:[
- javaHome := javaHome / 'jre'.
- ].
- ^javaHome
- ]
- ].
-
- self javaHomes do:
- [:home| | homeAsFilename |
- homeAsFilename := home asFilename.
- homeAsFilename exists ifTrue:
- [(self validateJavaHome: homeAsFilename) ifTrue:
- [^javaHome := home]]].
-
- ^nil
-
- "Created: / 27-10-2010 / 19:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 22-11-2010 / 13:18:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 15-03-2011 / 13:29:14 / Jan Kurs <kursjan@fit.cvut.cz>"
- "Modified: / 15-03-2011 / 13:47:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 19-07-2012 / 11:08:04 / jv"
-!
-
-searchForSourcePath
-
- | src_zip |
-
- sourcePath := OrderedCollection new.
- src_zip := self javaHome asFilename directory / 'src.zip'.
- src_zip exists ifTrue:[sourcePath add: (JavaPathElement newFromRelease:src_zip asString)].
-
- "
- JavaRelease openJDK6 searchForSourcePath; sourcePath
- "
-
- "Created: / 27-10-2010 / 21:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-07-2012 / 11:45:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease methodsFor:'validating'!
-
-validateJavaHome: home
-
- "Just JRE"
- ( home asFilename / 'lib' / 'rt.jar' ) exists ifTrue:[^true].
-
- "Full JDK"
- ( home asFilename / 'jre' / 'lib' / 'rt.jar' ) exists ifTrue:[^true].
-
- ^ false
-
- "
- JavaRelease basicNew validateJavaHome: '/usr/lib/jvm/java-6-openjdk'
- JavaRelease basicNew validateJavaHome: '/tmp'
- "
-
- "Created: / 27-10-2010 / 19:14:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-10-2010 / 21:47:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::Custom class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-
-"
-!
-
-version_SVN
- ^ '$Id:: $'
-! !
-
-!JavaRelease::Custom methodsFor:'accessing'!
-
-bootClassPathOnUNIX
- "superclass JavaRelease says that I am responsible to implement this method"
-
- ^ self shouldImplement
-!
-
-bootClassPathOnWindows
- "superclass JavaRelease says that I am responsible to implement this method"
-
- ^ self shouldImplement
-!
-
-javaHome
-
- "Answer a Java home"
-
- javaHome isNil ifTrue:[
- javaHome := OperatingSystem getEnvironment:'JAVA_HOME'.
- ].
- ^javaHome
-
- "
- JavaRelease custom javaHome
- "
-
- "Created: / 26-07-2012 / 23:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHome: aString
- javaHome := aString
-
- "
- JavaRelease openJDK6 javaHome
- "
-
- "Created: / 26-07-2012 / 23:32:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomesOnUNIX
- "raise an error: must be redefined in concrete subclass(es)"
-
- ^ self shouldNotImplement
-
- "Modified: / 27-07-2012 / 00:02:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomesOnWindows
- "raise an error: must be redefined in concrete subclass(es)"
-
- ^ self shouldNotImplement
-
- "Modified: / 27-07-2012 / 00:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-name
- "superclass JavaRelease says that I am responsible to implement this method"
-
- ^ 'Custom'
-
- "Modified: / 27-07-2012 / 00:02:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-priority
-
- ^1
-
- "Created: / 26-07-2012 / 23:38:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-selector
- "Returns instance-creation selector to get the receiver.
- See JavaRelease class, protocol instance creation"
-
- ^#custom
-
- "Created: / 27-07-2012 / 10:04:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::Custom methodsFor:'initialization'!
-
-initialize
- "Initialize lazily in javaHome:"
-
- "Created: / 26-07-2012 / 23:40:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::Custom methodsFor:'queries'!
-
-isAvailable
- ^true
-
- "Created: / 26-07-2012 / 23:35:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-isCustom
- ^true
-
- "Created: / 27-07-2012 / 00:08:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::Custom methodsFor:'searching'!
-
-searchForJavaHome
- self shouldNotImplement
-
- "Created: / 26-07-2012 / 23:34:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::OpenJDK6 class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-
-"
-!
-
-version_SVN
- ^ '$Id:: $'
-! !
-
-!JavaRelease::OpenJDK6 methodsFor:'accessing'!
-
-bootClassPathOnUNIX
-
- | jre |
- jre := self jreHome.
-
- ^ {
- jre / 'lib' / 'resources.jar' .
- jre / 'lib' / 'rt.jar' .
- jre / 'lib' / 'jsse.jar' .
- jre / 'lib' / 'jce.jar' .
- jre / 'lib' / 'charsets.jar' .
- }
-
- "
- JavaRelease openJDK6 bootClassPathOnUNIX
- "
-
- "Created: / 02-11-2011 / 12:36:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified (comment): / 02-11-2011 / 23:39:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-bootClassPathOnWindows
-
- "This should be the same as on UNIX, we'll see..."
-
- ^self bootClassPathOnUNIX
-
- "Created: / 02-11-2011 / 12:36:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Created: / 02-11-2011 / 23:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaExtDirsOnUNIX
-
- ^{
- self javaHome asFilename / 'lib' / 'ext' .
- '/usr/java/packages/lib/ext' asFilename
- }
-
- "Created: / 31-08-2011 / 20:01:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaExtDirsOnWindows
-
- ^{
- self javaHome asFilename / 'lib' / 'ext' .
- }
-
- "Created: / 31-08-2011 / 20:02:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomesOnUNIX
- ^ #( '/usr/lib/jvm/java-6-openjdk/jre' )
-
- "Modified: / 07-08-2011 / 20:38:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-name
- "superclass JavaRelease says that I am responsible to implement this method"
-
- ^ 'Open JDK 6'
-
- "Modified: / 27-10-2010 / 19:16:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-priority
-
- ^80
- "/^70
-
- "Created: / 22-11-2010 / 13:35:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 04-02-2011 / 06:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-selector
- "Returns instance-creation selector to get the receiver.
- See JavaRelease class, protocol instance creation"
-
- ^#openJDK6
-
- "Created: / 27-07-2012 / 10:05:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::OpenJDK6 methodsFor:'private'!
-
-javaHomeOnWindowsJDKDirectoryPrefix
- ^'jdk1.6'
-
- "Created: / 19-07-2012 / 11:04:34 / jv"
-! !
-
-!JavaRelease::OpenJDK7 class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-
-"
-!
-
-version_SVN
- ^ '$Id:: $'
-! !
-
-!JavaRelease::OpenJDK7 methodsFor:'accessing'!
-
-javaHomesOnUNIX
- | arch |
-
- arch := OperatingSystem getSystemInfo at:#machine.
- arch = 'x86_64' ifTrue:[arch := 'amd64'].
-
- ^ { '/usr/lib/jvm/java-7-openjdk/jre' .
- '/usr/lib/jvm/java-7-openjdk-',arch,'/jre' }
-
- "
- JavaRelease::OpenJDK7 new javaHomesOnUNIX
- "
-
- "Created: / 11-02-2012 / 17:47:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-name
- ^ 'OpenJDK7 (not yet supported)'
-
- "Created: / 27-07-2012 / 00:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-priority
-
- ^ super priority - 10
- "/^70
-
- "Modified: / 04-02-2011 / 06:59:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Created: / 11-02-2012 / 17:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-selector
- "Returns instance-creation selector to get the receiver.
- See JavaRelease class, protocol instance creation"
-
- ^#openJDK7
-
- "Created: / 27-07-2012 / 10:05:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::OpenJDK7 methodsFor:'private'!
-
-javaHomeOnWindowsJDKDirectoryPrefix
- ^'jdk1.7'
-
- "Created: / 19-07-2012 / 11:05:02 / jv"
-! !
-
-!JavaRelease::SunJDK122 class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-
-"
-!
-
-version_SVN
- ^ '$Id:: $'
-! !
-
-!JavaRelease::SunJDK122 methodsFor:'accessing'!
-
-javaHomesOnUNIX
- "superclass JavaRelease says that I am responsible to implement this method"
-
- ^#(
- '/home/jv/Projects/JavaX/jdk1.2.2' "/On Jan Vrany's machine :-)
- )
-
- "Created: / 22-11-2010 / 13:26:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomesOnWindows
-
- ^ #()
-
-!
-
-name
- "superclass JavaRelease says that I am responsible to implement this method"
-
- ^ 'Sun JDK 1.2.2'
-
- "Modified: / 27-07-2012 / 00:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-priority
-
- ^10
-
- "Created: / 22-11-2010 / 13:34:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-selector
- "Returns instance-creation selector to get the receiver.
- See JavaRelease class, protocol instance creation"
-
- ^#sunJDK122
-
- "Created: / 27-07-2012 / 10:06:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::SunJDK122 methodsFor:'displaying'!
-
-displayString
-
- ^self isAvailable ifTrue:[
- self name
- ] ifFalse:[
- (self name , ' ' , '(not available)') asText colorizeAllWith: Color gray
- ]
-
- "Created: / 27-07-2012 / 00:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::SunJDK122 methodsFor:'queries'!
-
-isAvailable
- "We don't really support it"
-
- ^false
-
- "Created: / 27-07-2012 / 00:04:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease::SunJDK6 class methodsFor:'documentation'!
-
-copyright
-"
- COPYRIGHT (c) 1996-2011 by Claus Gittinger
-
- New code and modifications done at SWING Research Group [1]:
-
- COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
- SWING Research Group, Czech Technical University in Prague
-
- This software is furnished under a license and may be used
- only in accordance with the terms of that license and with the
- inclusion of the above copyright notice. This software may not
- be provided or otherwise made available to, or used by, any
- other person. No title to or ownership of the software is
- hereby transferred.
-
- [1] Code written at SWING Research Group contains a signature
- of one of the above copright owners. For exact set of such code,
- see the differences between this version and version stx:libjava
- as of 1.9.2010
-
-"
-!
-
-version_SVN
- ^ '$Id:: $'
-! !
-
-!JavaRelease::SunJDK6 methodsFor:'accessing'!
-
-javaHomesOnUNIX
-
- ^ #( '/usr/lib/jvm/java-6-sun' )
-
- "Created: / 22-11-2010 / 13:31:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-javaHomesOnWindows
- |entry vsn home paths |
-
- entry := (OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit').
- entry notNil ifTrue:[
- vsn := entry valueNamed:'CurrentVersion'.
- ].
- vsn notNil ifTrue:[
- entry := (OperatingSystem registryEntry
- key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\',vsn).
- home := entry valueNamed:'JavaHome'.
- home notNil ifTrue:[
- ^ (Array with:(home,'\jre'))
- ].
- ].
- paths := OrderedCollection new.
- #(
- 'C:\Program Files\Java'
- 'C:\Program Files (x86)\Java'
- ) do:[:rootpath|
- | root |
-
- root := rootpath asFilename.
- root exists ifTrue:[
- root directoryContents do:[:dir|
- (dir startsWith:self javaHomeOnWindowsJDKDirectoryPrefix) ifTrue:[
- | path |
- (path := root / dir / 'jre') isDirectory ifTrue:[
- paths add: path
- ].
- ].
- ]
- ]
- ].
-
- ^ paths
-
- "
- self basicNew javaHomesOnWindows
- "
-
- "Modified: / 07-08-2011 / 20:38:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 19-08-2011 / 00:46:40 / cg"
- "Modified: / 19-07-2012 / 11:04:44 / jv"
-!
-
-name
-
- ^ 'Sun JDK 6'
-
- "Created: / 22-11-2010 / 13:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-priority
-
- "/There is no OpenJDK 6 for Windows yet...
- OperatingSystem isMSWINDOWSlike ifTrue:[
- ^100
- ].
- ^75
-
- "Created: / 22-11-2010 / 13:35:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 19-07-2012 / 10:57:55 / jv"
-!
-
-selector
- "Returns instance-creation selector to get the receiver.
- See JavaRelease class, protocol instance creation"
-
- ^#sunJDK6
-
- "Created: / 27-07-2012 / 10:05:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!JavaRelease class methodsFor:'documentation'!
-
-version_SVN
-
- ^ '$Id$'
-
-! !