mostly for zimbra developper : OsX-java1.5-usr/bin/java and opt/zimbra/java

Ask questions about your setup or get help installing ZCS server (ZD section below).
s3nz3x
Posts: 33
Joined: Fri Sep 12, 2014 10:01 pm

mostly for zimbra developper : OsX-java1.5-usr/bin/java and opt/zimbra/java

Postby s3nz3x » Sun Dec 04, 2005 3:34 pm

AS I wrote in quite some posts here, I DID CHANGE the symlink of CurrentJDK to directly point to 1.5.0 in /System/Library/FrameworksÂ…

wich is as far as I'm concerned the only way I've found to get things work in OsX.

AS it's said on the here, on the net & other forums, it is not recommanded to do it, which I understand.
So I did try to make a New fresh Install, on a virgin partition on another internal disc (on the same box that I'm using with the working Zimbra server) (and with another NIC card, mainly because I'm using AppleRemoteDesktop and it relays more on MAC adresses which in fact turned to confuse ARD and the zimbra box itself, because just to be sure I did change the domain name to not messing around with my working install aka (Working install#1 is zimbra.zimbra.org and second one is brazim.brazim.org) all my DNS are fine and running on OsX server and on my gigabitfirewall IPCOP Router wich is my second DNS server.)
Pffffff, ok Now that all is explained and set I'm coming to JAVA Issue:
-zimbraInstall#1 : when I change the CurrentJDK symlink to 1.5.0 = everything is fine, really fine.
-ZimbraInstall#2 : before installing zimbra I did put those two line in /etc/profile :
launch Terminal as admin or root (I did it as root -so no need to type password which I found to be finally faster when testing etc,Â…) anyway launched terminal window and type:

pico /etc/profile

hit enter and at the end just typed those 2 lines

export JAVA_HOME=/system/Library/Frameworks/JAVAVM.Framework/1.5.0/Home

export PATH=$JAVA_HOME/bin:$PATH
hit enter to add a line and Ctrl-O to save the file.

no just type logout, close the window. Get a New terminal window and type
Java -version:
tada !

Java 1.5 shows up!
This also make you avoid to edit the .bashrc file in Users, it's going to be applied to all users. You could also only put that for one single user like zimbra user for instanceÂ… but as I run StartupItems (by the root user) I prefred to apply this to all user. I could see later if I would or not apply it only for zimbra user or not.
Then log in as any other user or the zimbra user if you already created it (but don't install zimbra yet as if java not correctly setted up, I found that install and post-install script didn't went good) and just verify that JAVA 1.5 shows too. wich it will.

So here we think, all of us, Yeah! I did it! no need to trick the Symlink in the System as lots of guys suggested;

but, now comes the "zimbra-java-related problem" if I could say.
In that case you, again as suggested, didn't tricked the system and just edited the /etc/profile.

And you've got JAVA 1.5 showing up as wanted.

I did a little script to do itÂ… and I'll post it in case this is solved, but as you'll read on this is not.
As nigelkersten said here http://www.zimbra.com/forums/showpost.php?p=5177&postcount=8

[quote]as far as JAVA_HOME goes, I notice that zimbra sets it to /usr with the setup script... it should probably be /Library/Java/Home under OS X, but I'll see whether that works. It will for the java executable as /usr/bin contains a link to the Commands in /Library/Java/Home, but other things may not work so well.[/quote]

the java symlink in /opt/zimbra/java point to /usr

and here is the "STUFF".

/usr has /bin in which there is a java symlink

aka /usr/bin/java pointing in fact to /system/Library/Frameworks/JAVAVM.Framework/1.4.2/Commands/java

(wich is the same as : /system/Library/Frameworks/JAVAVM.Framework/1.4.2/Home/bin/java (java is a symlink hereÂ…)

!!

so even if you did edited 'the good way' /etc/profile, /usr/bin/java still points to the 1.4.2 Java Version.

So, Houston, we here may have a pbÂ… ? because /opt/zimbra/java is the same as /usr/bin/java which is the same as /system/Library/Frameworks/JAVAVM.Framework/1.4.2/Commands/java.
Following me ? ;)

this is why (I think) the only way to get this working is to trick the symilnk of the currentJDK, and I'll explains more:

A)

you tricked the CurrentJDK symlink to point to 1.5.0 (the ugly way as I say)

the command:

java -version

gives you 1.5.0 as expected
and the command:

which java

gives you:

/usr/bin/java
so now you do see the "link" with /opt/zimbra/java right ?
B)

if you edited /etc/profile

the command:

java -version

gives you 1.5.0 as expected
and the command:

which java

gives you:

/System/Library/Frameworks/JAVAVM.Framework/1.5.0/Home/bin/java
Which is fine BUT in that case /opt/zimbra/java STILL point to /usr/bin/java wich STILL points to

/system/Library/Frameworks/JAVAVM.Framework/1.4.2/Commands/java and that's not good.
So I've tried 'ugly' things just to understand.
Despite this, I found that

usr/bin/java symlink relays on the CurrentJDK ! this is why the ugly way (#1) just works with no single pb, because in that case the /usr/bin/java automatically points to the CurrentJDK/Commands/java
OK, now you you're beginning to see somethingÂ…


If you like to see by yourself, you can test it like this:
Test1-

Don't "Trick" the CurrentJDK symlink, and don't edit /etc/profile

go in finder and in the Go menu choose 'Go to folder' and type /usr/bin

Now just select java and hit 'Command-R' to get to the 'source'

-> you'll get to 1.4.2/Commands/java
Test2-

Don't "Trick" the CurrentJDK symlink, and edit /etc/profile

go in finder and in the Go menu choose 'Go to folder' and type /usr/bin

Now just select java and hit 'Command-R' to get to the 'source'

-> you'll get to 1.4.2/Commands/java AGAIN ! (not 1.5.0/Commands/java which is what you want)
Test3-

Do "Trick" the CurrentJDK symlink, (and do or don't edit /etc/profile this has no more importance now)

go in finder and in the Go menu choose 'Go to folder' and type /usr/bin

Now just select java and hit 'Command-R' to get to the 'source'

-> you'll get to 1.5.0/Commands/java (Wich is What you do want, right ?)
Note: you don't need to restart nor logout (of the finder). just type logout at the terminal window (after changing CurrentJDK symlinks and/or editing /etc/profile) and launch a new Terminal window.

Yeah legendary User friendly MACPOWER ;-) (even if bugs exits on my favorite platformÂ…, let's be honest a bit, Uh! s3nz3x pro-mac user)

(So I would suggest to trick CurrentJDK and eventually edit per user .bashrc or /etc/profile to get java 1.4.2 if really needed for example)
Now, what other 'ugly' things did I tried? considering that I edited /etc/profile to point to java 1.5 and DID NOT change the symlink of CurrentJDK

I tried to, in disorder ( I don't really remember the order as I tried all this for a non-stop 36-48h night & days, well in fact quite all the past week.

Yes it's true, I'm a bit focused sometimes, and I just mainly prefer to work @ night, as I can afford to wake up @ 9-10 or 11 AM - when I go to sleep every day of the year like @ 2 to 4 PM, I'm no vampireÂ…;-0
).

Ok so, I did:

A) Forced all the java related symlink in /usr/bin to point to 1.5.0/Commands/
B) Just SUPPRESSED all the java related symlink in /usr/bin
C) Changed /opt/zimbra/java to point to :

/System/Library/Frameworks/JAVAVM.Framework/1.5.0/Home/bin/
D) Changed /opt/zimbra/java to point to :

/System/Library/Frameworks/JAVAVM.Framework/1.5.0/Commands/bin/
E) Changed /opt/zimbra/java to point to :

/System/Library/Frameworks/JAVAVM.Framework/1.5.0/Home/bin/
I've tried all this because I was a little confused with 'real' definition of JAVA_HOME.
for me it was /system/Library/Frameworks/JAVAVM.Framework/1.4.2(or1.5.0)/Commands/java

but as I read many files of zimbra folders I saw that it was more the so called Home folder

like /system/Library/Frameworks/JAVAVM.Framework/1.4.2(or1.5.0)/Home wich is many times followed with /bin (Cf above the /etc/profile editing).
Anyway, the MAX BEST RESULTS I've come to get was:

antispam Stopped

antivirus Running

ldap Running

logger Stopped

mailbox Running

mta Stopped

snmp Stopped

spell Running
Another thing I 'discovered' is that tools.jar just doesn't exists on OsX.

On other Oses is more or less at the location /JAVA-theversionyouwant-/Home/lib/tools.jar.

On OsX Boxes tools.jar is named classes.jar and is located @ /JAVA-theversionyouwant-/Classes/classes.jar

So I did, during a short second, think I found something here, but even if I've read somewhere, a suggestion to create a symlink of classes.jar and name it tools.jar

like /thejavaversionyouwant/Classes/classes.jar to /thejavaversionyouwant/Home/lib/tools.jar, I didn't tried it because :

For sure zimbra developpers knew it because 1- if not, even in the 'UGLY WAY' it wouldn't work at all and it does work.

2- in the /opt/zimbra/jakarta-tomcat-5.5.7/bin/setclasspath.sh they've done a special OsX Tricks. They ARE JAVA programmers and for sure knew about this.
I've mostly posted this romance, in case it would give clues to anyone of us knowing java, and in case it could help ZimbraDevs to get zimbra work without having to do the UGLY way (wich in fact I don't care because I'll install zimbra on its own box so I wont use it for anything else, but just for the principe, I'd like to do this the clean way if I may say.)
thanks for readingÂ…

s3nz3x.


Return to “Installation and Upgrade”

Who is online

Users browsing this forum: No registered users and 3 guests