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

Something finally went my way! after days of trolling the internet, I got Appcelerator’s Titanium Developer Desktop 1.2.1 working in a 32 bit Ubuntu 10.04 Virtual Machine, next stop to try and get it running on an x64 Ubuntu install. I am really getting ticked off with the formatting issues, and I may try switching website themes to see if it fixes it (I might have caused the formatting issues when I was trying to resolve the header issue at the end of April (see below, I had 2 links on the main menu up top that both took you to this page and I edited out one of them from the css code for this template)), as I am tired of crappy looking pages and I think it is all my fault. After I play with the x64 Titanium install, I’ll post some thing (maybe a big complaint about something I can do nothing about but complain, or I may find something more constructive…) I’ll go ahead and play with the themes (most likely monday-wednesday time frame). Until then, enjoy my horribly formatted text blocks!! (want to see the worst one? go look at my new post and check out what it did to the text around the screenshot!!!)

Ok, I went to the Radio Shack I purchased my phone from, they have had one return, for a very idiotic reason, the user reported that zero incoming calls ever rang through to the phone… I told the manager that I’d put $500 down that he accidentally setup Google Voice on his Evo, but never logged into the web and configured it, nor did he have a gmail account, nor did they set one up with the phone when he bought it.  So, he has all of his incoming calls “blocked” by Google Voice and is not getting the voicemail notifications, because he did not setup his phone to receive gmail messages. HA! too funny…  Also, none of the employees in the store have even heard of ANY of the issues that has been going on around the web with the HTC Evo (see links at the end of this post).  I spent about 30 minutes at the store “educating” the employees about the problems plaguing the HTC Evo.

Afterwards I went to a nearby Sprint repair center, they have not had a single Evo returned, nor have they even heard of ANY of the issues that are being reported on the web. The sales person I talked to was fairly knowledgeable, although he admitted to only having seen 3 HTC Evo’s prior to mine, I was able to cover all of the issues within 15 minutes (they closed while I was doing this) and show him the light leak and the “moving glass” issue from my phone.

I’ve been using my Jabra Cruiser Car Speaker phone (BlueTooth and FM transmitter) with my Evo for 2.5 days now, and I must say it has been working very well.  I love it, I had 1 issue where the Jabra connected, but only connected for phone audio, not music playback, but I just had to turn off the Jabra and turn it back on.  Now, when I was driving home from Radio Shack and Sprint, I was listening to Pandora through my Evo and the Jabra, played out through my car Stereo Speakers.  It sounded, well… good although I have a 200 Ford Mustang with the 6 speaker CD player audio package, and the passenger front speaker has a major tear in it and I believe at least one of the rear speakers has a small rip in the speaker fiber (not the original owner and I received the vehicle in that condition…)  So I do not know if that is a good review of the sound quality.

Then I got home and had a lovely reboot issue, I turned off my BlueTooth Speakerphone, and the Evo locked up on my desktop/home screen with a message “BlueTooth Device Disconnected” in a pretty little grey bubble.  it sat on that screen for 3 minutes, then the phone rebooted.  But wait!!! it gets better… the phone got stuck on the 4G logo (after the video ended) and sat there for 10 more minutes, without dimming the screen, or shutting it off, then it rebooted again!!!  I popped out the kickstand and sat the phone on the kitchen table and started to eat my dinner… You won’t believe me, but it rebooted while I was eating AND stuck on the 4G logo screen again! then after 2-4 minutes it rebooted itself (off the 4G logo screen) and made it back to my desktop/home screens.  has not rebooted since and I did use my new headset to both listen to Pandora and to take 2 phone calls (about 80 minutes total).

Today I also received my Nuvelli stereo BlueTooth headset/headphones, they are a lot smaller than I originally thought ( a little smaller than a half dollar coin), sound pretty good for music and fairly good for voice, but not perfect; however my one severely audiophilic friend (one of the two people I have talked to so far, while using the headset) said it sound like I am underwater and have severe echo.  I then talked to my wife, who is very picky, and she said that I “sound like shit” and should return the headset.  I tried to sync it with my PC (Ubuntu 10.04) and the BlueTooth device manager said that my BlueTooth device does not support “input” (note, it also said this about my HTC Evo).

Since I was completely unable to find any real information on this device online, I have happily created an absolutely horrible unboxing which you will find below, including a pdf file of the English section of the manual (If you are reading this and would really like the Spanish version, you might be able to bribe me to scan the pages written in Spanish too… maybe), that I made myself.  You also will not find ANY of this information on the manufacturer’s website or even on Amazon.com.

Tagged with:
 

So, I’ve started with a clean OS install in a virtual box VM (see screen shot) and here is where I’ve gone from there (currently not working, waiting on some advice from the Titanium Developers forums)…

Titanium Kubuntu 10.04 Virtual Machine Settings

Titanium Kubuntu 10.04 Virtual Machine Settings

Before we get started I want to make sure you know that there are a lot of steps below and that not all of them are necessary, again this is just how I did it.

*********update 5-17-2010**********

(on doing this again on a new from scratch system I have learned that in the Java section, steps 10-31 may not be necessary at all. while this is a good thing to have setup on your system for future upgrades, it is not necessary UNLESS you have the open source java installed prior to installing java (or anytime after installing java. this is actually out of order in these steps, you would have to do steps 1-7 in the following section (installing gcj-4.4-base) BEFORE doing the Java section, else steps 10-31 will not work.)

First let’s finish setting up the Ubuntu installation and get out guest additions installed. (although I use KDE, all of this should work from gnome, or ice, or xfce, or whatever GUI window manager you have chosen.

  1. sudo apt-get update
  2. sudo apt-get install dpkg dpkg-devel
  3. sudo apt-get dselect-upgrade
  4. sudo apt-get install yakuake
  5. reboot
  6. sudo apt-get autoremove
  7. select “devices” from the VM window
  8. select “install Guest Additions”
  9. when the “devices recently plugged in” window appears, click on the VBox guest additions, and select browse with Dolphin. this will mount the CD in /media for you
  10. cd /media/VB[press the tab here for auto-completion, as the name changes for every version of VirtualBox]
  11. sudo ./VBoxLinuxAdditions-x86.run
  12. wait for it to finish, then reboot your system (simplest way, not only method)

Now you should be able to resize your screen by just resizing the VBox window, and your mouse should move between host and guest without exclusivity, you also should get better performance if your host is outdated or low end.

Let’s install java SE JDK!

  1. cd ~/Downloads
  2. mkdir android
  3. mkdir android/environment
  4. mkdir android/environment/system
  5. http://java.sun.com/javase/downloads/widget/jdk6.jsp (this is where you need to go to get the current Java SE JDK, I tried to find a direct url useable by wget, but they have it scripted so you need to use the web browser, save this file in /opt/java)
  6. cd /opt/java
  7. sudo chmod +x jdk*
  8. sudo ./jdk-6u20-linux-i586.bin (may need to change the name depending on the the version you downloaded, this will install/extract java into the /opt/java directory)
  9. sudo rm jdk-6u20-linux-i586.bin (since this is a vm, it is a good idea to clean up after yourself! the final virtual hdd is gonna be pretty big anyway)
  10. sudo ln -s /opt/java/jdk1.5.0_09 /usr/lib/jvm/java-sun
  11. sudo vi /etc/jvm (this file did not exist for me, do not know why you need to do this or if you can skip this step)
  12. O
  13. “/usr/lib/jvm/java-sun” (make sure to include the quotes, again I do not know why, but the Ubuntu Forum post I found said to do it this way)
  14. sudo cp /usr/lib/jvm/.java-gcj-jinfo /usr/lib/jvm/.java-sun-jinfo (this file does not exist on my system, if you have it do steps 14 – 17, if not skip them, as he did not give the details of the expected file contents)
  15. sudo vi /usr/lib/jvm/.java-sun.jinfo
  16. [esc] :%s/java-gcj/java-sun/g (make sure to get the colon as the first character if you are copy and pasting!! this line replaces all the gcj’s with sun, gcj is the GNU open source version of java, what we are doing here is replacing the references to it with references to the newly installed sun java so your system will use sun java instead of the GNU java)
  17. [esc] :wq!
  18. sudo apt-get install galternatives
  19. sudo ln -s /usr/lib/jvm/java-sun/ /etc/alternatives/java-sun
  20. galternatives (this will run the GUI version of alternatives so you can make edits on the files without using vi)
  21. select each of the following one by one and repeat steps 22 – 24 for each one. jar, jarsigner, java, javac, javadoc, javah, native2ascii, rmic, rmid, rmiregistry, serialver
  22. click ‘add’
  23. set path to /etc/alternatives/java-sun/bin/[name of what you are changing, ie jar, java, javah, javap...]
  24. set the priority to the “gcj priority”+1 (note it will not allow you to input numbers greater than 1000 in the GUI, those must be done manually, so just set them to 1000 at this time. it is recommended not to set them to manual, so see step 34 after completing all of these additions for how to make these the defaults.)
  25. sudo update-alternatives –force –install /etc/alternatives/javap javap /usr/lib/jvm/java-sun/bin/javap 1066 (javap did not exist for me so I had to enter this at the command line, it returned multiple errors; however when I reran galternatives, the new setting was there.)
  26. cd /var/lib/dpkg/alternatives
  27. sudo vi java (repeat this process, steps 27 – 29, for all the changes above that you were not able to set the priority over 1000 on)
  28. [esc] :%s/1044/944/ (replace the “1044″ with the number that your system has, this may be different for each file. for simplicity, set the “944″ to the number your system has – 100)
  29. [esc] :wq! (note, this is not necessarily the fastest nor most efficient way of using vi, nor is it the way I usually do it; however I use this method when I write this information out, because it will work regardless of the contents in your file that are/were not in mine AND because without actually seeing the file I cannot tell you “go to line # 5′ or ‘change the third word of the eighth line to “blah”‘. this method should prevent you from inadvertently changing something you should not, I hope…)
  30. java -version (this should display the version you just downloaded and installed, if not… go over the steps again and make sure you followed them all, else… well back to searching the inet for a solution, for you!
  31. javac -version (just in case check this one too!)

Right now that that is done, let’s move on to installing the dependencies for your development environment (again, may not be the only method, nor even the recommended one, but this is what I have done!)

  1. cd ~/Downloads/android/environment/system (this will keep your home folder from filling with source code and build files)
  2. sudo apt-get install debhelper gcj-4.4-base gcj-jdk m4 debiandoc-sgml python-docutils cdbs (these are the dependencies for step 3 and need to be installed first)
  3. sudo apt-get -b source gcc-defaults gcc++ python-defaults ruby-defaults
  4. sudo apt-get update
  5. sudo apt-get dselect-upgrade (check for any updates to the files you have just installed, always a good thing!)
  6. sudo apt-get autoremove (this removed 85.2MB for me)
  7. at this point I did a complete shutdown and created a snapshot in VirtualBox. current Virtual HDD file was 4.72GB before I took the snapshot. (in case I messed something up in the next part, as we have accomplished a good bit of work at this stage)

Now that all of your prerequisites have been installed, let’s install our development environment! (finally)

  1. go to http://developer.android.com/sdk/adding-components.html and download the android SDK to /opt
  2. using dolphin (or your favorite GUI folder browser) find this file and right click on it, select extract here
  3. cd android-sdk-linux_x86/tools
  4. sudo ./android
  5. goto settings first and check the box for “force https://”
  6. select available packages click the down arrow to the left of the web address shown.
  7. check the boxes for: SDK 1.6 API 4 R2 / SDK 2.1 API 7 R1 / Google API 1.6 / Google API 2.1 (this will let you code for Android 1.6 (more of these currently than any other OS version) and 2.1 devices (the newest available) and the google API’s will let you access the preinstalled google apps that come with android and their resources (google maps and voice command and such) I also recommend the samples and documentation files if you are new to coding for Android.
  8. click “install selected”
  9. click “accept all”
  10. click “install” (at this point it will begin installing, you can wait, or continue on to my next step while it does this, personally I let it run, and went to get something to eat!! make sure you check the details before closing, my 1.6 environment did not install with the error: finished with wrong size, expected 63422901 bytes received 4828132 bytes, this also caused the google APIs for 1.6 to fail and I had to re-attempt to install 1.6, everything worked the second time)
  11. cd ~
  12. vi .bashrc
  13. press the following “jjjO” (this will move you down 3 lines, insert a new line and allow you to start editing, then just copy and past the following 2 lines)
  14. export JAVA_HOME=/usr/lib/jvm/java-sun
  15. export PATH=$PATH:$JAVA_HOME:/opt/android-sdk/
  16. [esc] “wq!
  17. cd ~/Downloads/android/environment/system
  18. sudo wget http://www.appcelerator.com/download-linux32 (this should get you the “Titanium Developer.tgz” file)
  19. use dolphin again to right click and “extract here”
  20. now you should have a “Titanium Developer-1.2.1″ directory
  21. cd /opt/titanium/runtime/linux/1.0.0 (need to fix some incompatibilities that I found on the Titanium Developers forum)
  22. sudo mkdir backup
  23. sudo mv libgobject-2.0.* backup/
  24. sudo mv libglib-2.0.* backup/
  25. sudo mv libgio-2.0.* backup/
  26. sudo mv libgthread-2.0.* backup/
  27. cd ~/Downloads/android/environment/system/Titanium\ Developer-1.2.1/
  28. ./Titanium\ Developer (I have tried both with and without sudo, but it throws an error instead of running. I have posted a question on the Titanium Developers forum and linked it to here, so hopefully someone can help me out.)

Now that 32-bit is working, I’ll give the x64 version another shot this weekend. Hope I did not upset too many people over at the forums with my first post! but neither google nor bing came up with that forum post while I was searching…

Tagged with:
 
18 visitors online now
1 guests, 17 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