Part Three – Configuring Ubuntu to use your newly installed Java JRE and SDK
There are a lot of technical steps in this part, and I figured them out mostly through heavy internet searching, piecing together information from other blogs, and trial and error. The main issues were caused by every site expecting you to already have some key components installed before trying to get this working. So when I tried to follow their guides they never worked. That is why we are here now, using a fresh and clean Ubuntu installation.

updated for Java 7 on February 8th 2012

  1. cd /opt/java && sudo ln -s /opt/java/jdk1.7.0_02 /opt/java/jdk-linked && sudo ln -s /opt/java/jdk1.7.0_02/jre /opt/java/jre-linked – this moves back to the /opt/java directory and creates a link to the jdk folder that we can use to reference to later, that way if we ever install a newer version of java all you have to do is remove the links and create new ones, not have to go through this whole process again! you can test by typing cd jdk-linked && ls – and you will see the contents of /opt/java/jdk1.7.0_02 (don’t forget you can use [tab])
  2. sudo update-alternatives –install “/usr/bin/java” java “/opt/java/jre-linked/bin/java” 10 && sudo update-alternatives –set java /opt/java/jre-linked/bin/java – this updates Ubuntu so it can find your new jre and makes it the default jre to be used by the system (again future proofed because we used the linked location)
    • if you want to, we can setup java for Firefox too
    • mkdir ~/.mozilla/plugins/ && ln -s /opt/java/jre-linked/lib/i386/libnpjp2.so ~/.mozilla/plugins
  3. cd && vi .profile
    • [ctrl+f]
    • [o]
    • EXPORT JAVA_HOME=/opt/java/jdk-linked
    • [enter]
    • EXPORT PATH=$PATH:$JAVA_HOME:$JAVA_HOME/bin
    • [esc]
    • :wq!
  4. now we need to repeat the next set of instruction with the following items placed in [java] (everytime you see [java] put one of the following until you have done these steps for each of the following), I have noted after each one if you need a jre or jdk, or both lines for it, if both, replace the 10 with a 5 on the jdk (this will add both the jre and the jdk alternatives to the list making the jre ones the default). Or, just use this script. (remember to look at the script first to make sure it does what I said, and to set it as executable! cat java-update|more && chmod +x java-update then execute it with sudo ./java-update)
    • java – jre/jdk
    • jar – jdk
    • jarsigner – jdk
    • javac – jdk
    • javadoc – jdk
    • javah – jdk
    • native2ascii – jdk
    • rmic – jdk
    • rmid – jre/jdk
    • rmiregistry – jre/jdk
    • serialver – jdk
    1. sudo update-alternatives –install “/usr/bin/[java]” [java] “/opt/java/jre-linked/bin/[java]” 10
    2. sudo update-alternatives –set [java] /opt/java/jre-linked/bin/[java]
  5. mkdir ~/source-build && cd ~/source-build && sudo apt-get install debhelper gcj-4.4-base gcj-jdk m4 debiandoc-sgml python-docutils cdbs – moving on, we need to install some things before the adding Titanium to the system, this group (plus their dependencies, you don’t want to know what I went through to get this list exactly correct, it took a couple of months the first time I worked on getting this installed) takes up 823MB and took me 16 minutes to download and 2.5 minutes to install. as an fyi, I figured these out by not having them installed the first time around and spent weeks trying to figure each part out, because these files are not what causes the failed instal, linux will pull the dependencies for you when you install something, but there are dependencies of dependencies of dependencies… and somewhere down that line linux fails to grab the final set! So you need to install them in this order, I then spent another week or 2 finding out that those in particular have to be installed before the next set or the next set fails to install!
  6. sudo rm /var/lib/apt/lists/* && sudo apt-get update – this will resolve an issue with the sources of the next step
  7. sudo apt-get install llvm-gcc-4.5 && sudo apt-get build-dep llvm-gcc-4.5 && sudo apt-get -b source python-defaults ruby-defaults && sudo apt-get update && sudo apt-get dselect-upgrade && sudo apt-get autoremove – this set downloads the source files for each of these and builds them specifically for your system and then cleans itself up, this did prompt me for 62.5MB of additional storage space and the build process took about 20 to 45 seconds on my machine.
  8. sudo apt-get install ispell – I have found a few other things that are necessary for titanium to work
  9. restart your development VM
  10. mount your shared drives and take a new snapshot after the system comes back up, called pre Android SDK, and comments “OS, java jre&jdk, and compilers installed”

maybe you don’t really need all of this, but I don’t want to find out while I am writing my Android app that I missed a step, as then you won’t be able to re-use the snapshots in case of an emergency (also called a mistake!). One other note, if you noticed I made a new directory and used it for the source builds, this is because at least the python source build requires several chown commands to run and if you try to execute them on a VM share mount it will fail and you cannot complete the build. Congratulations! I know this was a tough part to do, and I’ll have to check it over sometime in the future to recreate the entire process step by step and make sure it all works again (never know where there might be a typo!). Next time we meet it will be to install the Android SDK and Titanium. After that we will build a short crappy Android app to test everything and then make an .iso Live CD of the whole VM! The final file was pretty big, I’m not sure if a Live DVD would cover it all! I’ll test this idea and add it to the final post if it works. I will be heading out of town for a couple of days so don’t expect anything before monday!

  1. part one
  2. part two
  3. part four

again, after I finish this series up, I’ll add in resource links

Well my first choice of Ubuntu’s JeOS is probably a lot more work than I want to go through, so I am preparing my backup plan.  Going to my favorite OS of choice, FreeBSD.  while looking up VMWare and linux hosts I came across a link that referenced FreeBSD, so I did a little more searching and now I want to list those links so I can find them later and hopefully get that to work when I get frustrated with JeOS (since I am not intending on using it as it’s creators intended, I am expecting it to fail, but want to try anyways as VMWare supports Ubuntu based OS as a Host OS and JeOS is a watered down Ubuntu Server, and overhead is a primary concern when dealing with Virtual Machines.  Maybe if I document well enough and it does work, my notes will get added to the VMWare and Ubuntu knowledgebases).

Anyways, FreeBSD links involving VMWare and/or just VMs

  1. Although dated December 2004 for the first post, this VMWare forum post includes responses from VMWare employees regarding not supporting FreeBSD as a Host OS.  Also includes links to a site where a non-employee had been providing a FreeBSD port for VMWare, but stopped maintaining it after VMWare Workstation 3.5 last post in the thread was dated Jan 16th 2010, and still no official support. (fyi I am looking into this, as I just got assigned to a VMWare support team and so I am trying to get more familiar with their products.  I would like to run VMWare on the most secure, least overhead Host OS possible, and I am already somewhat familiar with FreeBSD)
  2. instructions for enabling VMWare tools in *BSD guests
  3. instructions on installing VMWare tools in FreeBSD 8.x guest
  4. fantastic instructions on setting up FreeBSD 8 with KDE graphical environment, clear step by step install and post install instructions.  I will try them instead of doing Ubuntu’s JeOS as having this running even without VMWare would make me most happy.
  5. the FreeBSD Handbook page for third party applications for installing, upgrading, and building from source
  6. the FreeBSD Hanbook’s page on setting up VirtualBox in BSD
  7. the FreeBSD official wiki-site for setting up VirtualBox
16 visitors online now
0 guests, 16 bots, 0 members
Max visitors today: 22 at 12:58 pm PST
This month: 26 at 02-09-2012 11:53 am PST
This year: 29 at 01-11-2012 02:49 pm PST
All time: 1100 at 08-08-2011 08:11 pm PDT
View in: Mobile | Standard