There really isn't that much to get BlazeDS up and running on either of these systems, largely thanks to the ease of use built into Ubuntu. Here are the instructions to get it up and running.
1. Grab the Vancouver build of BlazeDS from here.
2. Unzip it to your desktop. Ubuntu 9.04 makes this simple as all you have to do is double click on the *.zip package, the same as OS X or Windows.
3. Check to see if you have a JDK configured and installed. To do this, grab a terminal and type in "javac" and see what comes back. If you have not installed a JDK before, you will get a message similar to this one:
4. This means you have to use a great feature of Ubuntu. The apt-get command is a powerful command-line tool used to work with Ubuntu's Advanced Packaging Tool (APT) performing such functions as installation of new software packages, upgrade of existing software packages and more. It can even update the O/S. apt-get has numerous advantages over other package management tools available in Ubuntu for server administrators. Some of these advantages include ease of use over simple terminal connections (SSH) and the ability to be used in system administration scripts, which can, in turn, be automated by the cron scheduling utility.
5. Run the command "sudo apt-get install sun-java6-jdk". This will install the Sun Java JDK. I chose this one over the others as I consider it the reference implementation for a JDK. Once you hit enter, you will be asked for your admin password and then the magic begins. I swear this was the easiest Java install I have ever done in my life. Thank you whoever created this tool at Ubuntu!!!
6. At some point during the install, you will be hit with the Sun license agreement. There will be a little (yes)
7. When this completes, you should be able to type "javac" into the command line and see the proper output (basically a prompt asking you for options).
8. Navigate to the folder where you saved the BlazeDS build from step 1. Using the terminal, chmod it to make it executable ( chmod -R 755 BlazeDS/ ). Chmod makes the file persist in a mode of "executable" if given the 755 argument. You may have to change to su to do this. This can be accomplished by typing in "sudo" in front of the command.
administrator@ubuntu-904:~/Desktop$ whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
12. Navigating to /etc/alternatives/java also revealed that this too was a symbolic link. The real target was /usr/lib/jvm/java-6-sun/jre/bin/java. This means that the real value for $JAVA_HOME will be /usr/lib/jvm/java-6-sun/.
13. To set this, use a line editor of your choice. I am going to use pico as pico is one I am familiar with. To do this, type the following in your terminal:
- "cd ~"
- "pico .bashrc"
14. Pico should bring up a configuration file. If it is not already filled in with lots of values, check the name of the config file and try again. In this file, you can add comments so I usually append my custom entries to the bottom of the file. In this case, at the very bottom, I enter the following lines of code:
# JAVA_HOME added by Duane Nickull
export JAVA_HOME=/usr/lib/jvm/java-6-sun
15. To save your .bashrc profile use "Control X" and answer "Y". Quit the current instance of terminal and open a new one. Test that your JAVA_HOME environmental variable is okay by typing in "echo $JAVA_HOME". You should see output like below:
16. With your terminal, navigate to the BlazeDS root folder, then change directory to the "sampledb" folder. Type in the following: "sh startdb.sh". The sample database should start up.
17. Start another instance of terminal and navigate to the BlazeDS root folder, then navigate to subfolders "tomcat" and "bin". Type in the following: "sh catalina.sh run".
18. Fire up a web browser and navigate to http://localhost:8400 (the default port the BlazeDS will be running on). Voila! You are done.
Coming up next will be some tutorials on Flex and AIR development on Linux if anyone is interested.
A good way to see where java is located is to list the files in the package:
ReplyDeletedpkg -L sun-java6-jdk
THanks Erik! I am just getting back into Linux after being disillusioned with both PC and OSX O/S's and really loving Ubuntu. Now if I could only encourage my company to make CS for Linux.... D'oh!!!
ReplyDeleteCS6 for Linux would really be something. You absolutely have my vote!
ReplyDeleteI have successfully installed blazeds on ubuntu server thanks to your article. Now when I try to create a flex project on windows and connect to ubuntu server, I mapped the root folder to my windows file system, when I click the validate configuration on flash builder 4, it shows the root folder is invalid.
ReplyDeleteSolutions? Many Thanks!
Mimi
@mimi - what value are you entering for the connections? It must be visible to your dev machine (anything lower than the root access you have will not work).
ReplyDeleteCould you please tell me where to find comparison between BlazeDS 3.x and 4.x. I am unable to find what's new in 4.x anywhere. Maybe I have been looking at all the wrong places.
ReplyDeleteFor sure! The release notes are here.
ReplyDeletehttp://opensource.adobe.com/wiki/display/blazeds/BlazeDS+4.0+Release+Notes
They outline all the fixed bugs and features.
Great thanks for this tutorial !!!
ReplyDeleteI'd like to use it on production server.
However, could you please specify me where to unzip BlazeDS build on a ubuntu tree structure ?
Thank you in advance for your help.
onrollover
@onrollover
ReplyDeleteOnce you have ensured the JAVA_HOME is set, you can literally place it anywhere you want. I put mine on the Desktop for development since I do a lot of demos for Adobe and like to not have to "cd" too much from my home directory to start it up.
Duane
By following step by step your tutorial and your comment advice, BlazeDS samples work very well on my online VPS !!!
ReplyDeleteThanks for that !
I plan to use it on an e-learning plateform, but I usually code in PHP with remoting AMF (not in Java).
So, I wonder if it's possible 2 applications to communicate together on the same website, one based on BlazeDS messaging and compiled with J2EE server in Flash Builder and the other based on AMF remoting services compiled with PHP server in FB4 too, ? Possible conflicts ?
Thanks for your tips.
I keep getting the following error:
ReplyDeleteNeither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
I know the Sun JDK is installed. My bash.bashrc file has the following at the top:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
What could be wrong?
Set JAVA_HOME / PATH for single user
ReplyDeleteLogin to your account and open .bash_profile file
$ vi ~/.bash_profile
Set JAVA_HOME as follows using syntax export JAVA_HOME=. If your path is set to /usr/java/jdk1.5.0_07/bin/java, set it as follows:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
Set PATH as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file. Just logout and login back to see new changes:
$ echo $JAVA_HOME
$ echo $PATH
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
$ which java
Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.