--- a/JavaRelease.st Thu Apr 10 15:39:50 2014 +0200
+++ b/JavaRelease.st Sun Apr 13 16:53:18 2014 +0200
@@ -367,7 +367,7 @@
releases sort:[:a :b | a priority > b priority ].
releases do:[:release |
(release validateJavaExecutable: javaExecutable) ifTrue:[
- release javaExecutable: javaExecutable.
+ "/ release javaExecutable: javaExecutable.
^ release.
].
]
@@ -415,7 +415,7 @@
javaExecutable isSymbolicLink ifTrue:[
javaExecutable := javaExecutable physicalFilename asAbsoluteFilename.
].
- System := self forExecutable: javaHome
+ System := self forExecutable: javaExecutable
].
^ System
@@ -1508,7 +1508,7 @@
!
priority
-
+ OperatingSystem isOSXlike ifTrue:[^ 100].
^80
"/^70
@@ -1525,6 +1525,71 @@
!JavaRelease::AppleJDK6 methodsFor:'searching'!
+javaExecutableForJavaHome: javaHomeArg
+ "For given java home (path to JRE root if JRE, or JDK root if part of full JDK) return
+ path to java executable (java.exe on Windows, java on UNIX). If no executable is found
+ in given root, return nil."
+
+ | javaHomeDirectory javaExecutableName javaExecutable |
+
+ "/ By default, java executable is either in <jdk root>/jre/bin or
+ "/ <jre root>/bin. So far only AppleJDK is different...
+
+ javaHomeArg isNil ifTrue:[ ^ nil ].
+ javaHomeDirectory := javaHomeArg asFilename asAbsoluteFilename.
+ javaHomeDirectory exists ifFalse:[ ^ nil ].
+ javaHomeDirectory isDirectory ifFalse:[ ^ nil ].
+ javaExecutableName := OperatingSystem isMSWINDOWSlike ifTrue:[ 'java.exe' ] ifFalse:[ 'java' ].
+
+ javaExecutable := javaHomeDirectory / 'Commands' / javaExecutableName.
+ javaExecutable exists ifTrue:[ ^ javaExecutable ].
+
+ ^ nil
+
+ "
+ JavaRelease basicNew javaExecutableForJavaHome: (OperatingSystem pathOfCommand:'java') asFilename directory directory.
+ JavaRelease basicNew javaExecutableForJavaHome: '/usr/lib/jvm/java-7-openjdk-amd64/jre'
+ JavaRelease basicNew javaExecutableForJavaHome: '/usr/lib/jvm/java-7-openjdk-amd64'
+ JavaRelease basicNew javaExecutableForJavaHome: 'xxxx'
+ JavaRelease basicNew javaExecutableForJavaHome: '/usr/bin'
+ "
+
+ "Created: / 08-04-2014 / 14:44:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaHomeForJavaExecutable: javaExecutable
+ "For given java executable (java.exe on Windows, java on UNIX) return
+ a Java home (path to JRE root (if JRE) or JDK root (if part of full JDK).
+ Upon failure (executable does not seem to be a part of JRE nor JDK), return
+ nil."
+
+ | javaExecutableFilename jdk|
+
+ "/ By default, java executable is either in <jdk root>/jre/bin or
+ "/ <jre root>/bin. So far only AppleJDK is different...
+
+ javaExecutable isNil ifTrue:[ ^ nil ].
+ javaExecutableFilename := javaExecutable asFilename asAbsoluteFilename.
+ javaExecutableFilename exists ifFalse:[ ^ nil ].
+ javaExecutableFilename isExecutable ifFalse:[ ^ nil ].
+
+ jdk := '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' asFilename.
+ jdk exists ifFalse:[^ nil].
+
+ (jdk construct:'Classes') exists ifFalse:[^ nil].
+ (jdk construct:'Classes/classes.jar') exists ifFalse:[^ nil].
+ ^ jdk
+
+ "
+ JavaRelease basicNew javaHomeForJavaExecutable: (OperatingSystem pathOfCommand:'java')
+ JavaRelease basicNew javaHomeForJavaExecutable: '/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java'
+ JavaRelease basicNew javaHomeForJavaExecutable: 'xxxx'
+ JavaRelease basicNew javaHomeForJavaExecutable: '/usr'
+ "
+
+ "Created: / 08-04-2014 / 14:21:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
searchForSourcePath
| jdkHome src_zip |
@@ -1549,6 +1614,22 @@
"Created: / 03-09-2012 / 18:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 23-01-2013 / 12:22:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (comment): / 06-02-2013 / 12:55:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+validateJavaHome1: home
+
+ home isNil ifTrue:[ ^ false ].
+
+ ( home asFilename / 'Classes' / self nameOf_rt_dot_jar ) exists ifTrue:[^true].
+
+ ^ false
+
+ "
+ JavaRelease basicNew validateJavaHome: '/usr/lib/jvm/java-6-openjdk'
+ JavaRelease basicNew validateJavaHome: '/tmp'
+ "
+
+ "Created: / 12-02-2013 / 02:50:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaRelease::AppleJDK6 methodsFor:'validating'!