cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dlacoste
Level 4

How To Make Solaris Work

New thread started to that it will hopefully solve the searching issues I've seen.

If you are experiencing the following:


  • java is in your path (this is NORMAL for solaris)
  • setupSolaris.bin (whatever you call your solaris launcher) won't run: it says "Initializing Wizard" and then "Verifying JVM" and then it exits (eventually)
  • you see errors in the log (if you set -is:log) that indicate that no JVM could be found, or that /bin/sparcv9/java could not be found
  • java -cp setup.jar run works (you can run your installer, but the install launcher can't)
  • setting JAVA_HOME causes the problem to go away


Then this is probably the issue:
the setup script can't deal with java in your path. It can handle finding java, and if JAVA_HOME is set it can find that, but not if it has to search your path. And on solaris (particularly solaris 10) it's always in your path (as /bin is /usr/bin, and /usr/bin is pretty much always in your path)

So, what to do?

Well, this works for me:

Methodology:
modify the script so that JAVA_HOME will always be set: if it's set, continue, if it's not set, then find a possible home for JAVA_HOME and then set that.

Notes:

  • I actually build on windows, and am using the cygwin 'sed' tool. If you are building on ANY other OS, please ensure that your 'sed' supports binary files. SOLARIS DOES NOT (read "man sed" and you can see that it explicitly does not support binary files.) If your 'sed' does not support binary properly, Verify.jar will be corrupted (you can unzip -t it to verify it) and thus any JVM found will be considered invalid)
  • Because of the twisted logic used in the script, the following MUST be true at all times:
    • The script must be written so that each of the file addons (Verify.jar, the *.jvm search scripts) is found on a 1024 byte boundary. This means that for every character you add (including newline characters) you must pad to 1024 characters to make the script work. For example, I added 391 characters, so I needed to add 633 characters to pad the files to 1024 byte boundaries.
    • The files must remain in unix line ending mode (if you run unix vi on the file, your added content should have no "^M" characters on any of the new lines.)

  • I'm using the "all of the JVM searches except the 64 bit ones" in my script and therefore the offsets that get updated at the end are for that many offsets. If you have more (or fewer) offsets, then you can remove the entries from the list. (The "00012800" part marks the start of the offset section.)
  • If you want more info on sed, please go buy the "sed & awk" O'Reilly book. It's a wonderful book and helped me through this (I didn't know you could sed with \ to replace with multiple lines, for example)


So, here's the code. You'll need to incorporate it into your build script (I'm using maven, so I'm going to end up using an ant section) but if you followed me so far you shouldn't have any problems:

[CODE]cat setupSolaris.bin|sed -b 's/initialize()/\
###############################################################################\
###############################################################################\
###############################################################################\
###############################################################################\
###############################################################################\
###############################################################################\
###############################################################################\
#######################################################################\
FindJavaHome()\
\{\
if [ "${JAVA_HOME}." = "." ] ; then \
if [ -d \/usr\/jdk\/latest\/bin\/. ] ; then \
JAVA_HOME=\/usr\/jdk\/latest \
export JAVA_HOME \
fi \
if [ -d \/usr\/java\/. ] ; then \
JAVA_HOME=\/usr\/java \
export JAVA_HOME \
fi \
if [ -d \/usr\/j2se\/. ] ; then \
JAVA_HOME=\/usr\/j2se \
export JAVA_HOME \
fi \
fi \
\}\
initialize()/' > setupSolaris.bin.modified

mv setupSolaris.bin.modified setupSolaris.bin

cat setupSolaris.bin|sed -b 's/pbc=1/FindJavaHome\
pbc=1/' > setupSolaris.bin.modified

mv setupSolaris.bin.modified setupSolaris.bin

cat setupSolaris.bin|sed -b 's/00012800/00012C00/' \
|sed -b 's/00012000/00012400/' \
|sed -b 's/00011800/00011C00/' \
|sed -b 's/00011000/00011400/' \
|sed -b 's/00010800/00010C00/' \
|sed -b 's/00010000/00010400/' \
|sed -b 's/0000F800/0000FC00/' \
|sed -b 's/0000F400/0000F800/' > setupSolaris.bin.modified

mv setupSolaris.bin.modified setupSolaris.bin
[/CODE]
Labels (1)
0 Kudos

(1) Reply
dlacoste
Level 4

OK, that worked, but it was picky (and annoying and difficult to implement).

SOOOOO I kept looking and TA-DA!

In your .jvm file (sun.jre.1.5.0.solaris.jvm for example)

Add the following to make the setup script NOT check your system path.

SKIP_PATH_SEARCH:true

The script does the following:

1 - check the system PATH variable for an occurence of java) this causes the "/usr/bin/sparcv9" and "invalid java /bin/java" messages, because you can't resolve the JAVA_HOME from /usr/bin or /bin on solaris!) (UNLESS SKIP_PATH_SEARCH is set to "true")

2 - check environment variables (for a list of which ones, check the PLATFORM_HINT section of your .jvm file)

3 - check the PATH_HINT locations

as #1 fails ALWAYS on solaris 9 and 10 because it can't identify JAVA_HOME, if you skip that part then parts 2 and 3 should work OK. Not great, but OK.
0 Kudos