Develop Anywhere with Dropbox, NetBeans and Xampp

By now, I would think everyone knows about Dropbox, it has been written about all over the web and is well used by even non-technical users as a “thumb drive on the web.” Many have figured out how to use it for more advanced tricks, such as syncing your music across computers or sharing photos with others. It’s one of those tools that is so flexible, it is easy to find new things to do with it. This is one of those.

The Components

For those of you who aren’t aware of Dropbox, it is a web folder syncing program that works with Windows, Mac and Linux. This will focus mainly on the Windows side of things, but I might touch on Linux as well. You sign up, and get 2gb of storage for free. (However, you and I will get a 250mb bonus if you use my referral links in this post.) The software syncs files you put in it’s folder with other computers you have registered as well as the web from when you are away.

Netbeans is an IDE written in Java. I’m no expert programmer, and I only use it for PHP, HTML, CSS type development, but if you use Java or another language Netbeans supports there should be no difference in the setup. IDEs tend to be an almost religious choice among developers, and it will be the most involved part of this setup, but it is still not that difficult.

XAMPP which has cousins for Mac and Linux (although with the ease of setting up a full-blown web server in Linux I am not sure why it is needed) is a bare-minimum and also portable version of Apache, PHP, MySQL, and others such as an FTP server and PHPMyAdmin for a full blown web server that can be trivially added to any OS. There is also a Lite version which is what I use to save on Dropbox’s limited space as I really do not need anything beyond Apache and MySQL.

The Setup

Dropbox

Obviously you first need a Dropbox account, go ahead and sign up. Download and install the software and you are done. One big tip here is that you will want your Dropbox folder installed in the same place across all your machines. By default it is your (My )Documents\Dropbox, with the “My” being for XP (Mac and Linux users it will be a sub directory of your Home folder) I personally recommend you change it to C:\Dropbox. Not only does this eliminate any issue between you having different user accounts across different computers, XAMPP is a bit happier with this setup.

XAMPP 

This one’s easy! I recommend downloading the zipped (not installer) version, and extract it to (dropbox folder)\xampp. (Note: In my case it is xampplite, just use what it wants to use.) Once again XAMPP  is a bit picky on where it likes to be, so I do not recommend renaming the xampp directory. It can be done, but it is more headache than I find benefit to. Jump in there and run xampp-control.exe, click ‘Start’ for Apache and congratulations you are running a web server. http://localhost is the place to go to test it. XAMPP comes with some sample stuff that you will be greeted with, as well as settings and advise on security. Feel free to peruse on your own. Note that your web documents themselves (and the example files) live in (dropbox folder)\xampp(lite)\htdocs.

Netbeans

Now we come to the fun part. None of this is hard, but it is not as cut and dry as installing the firs two. One reason is it does not have a portable installer. So on one machine, simply download (Current version as of the time of writing is 6.9) and install the version with the features you need. The PHP version is what I use, and it has the added benefit of being the smallest. The installer is straightforward and shouldn’t give you any surprises. Don’t try to install to your Dropbox folder at this time, we will take care of that in a moment.

Back? Time to get to work. It installed to your c:\Program Files\Netbeans 6.9 (or Program Files(x86)for 64bit OSes) navigate there and copy the Netbeans folder. Go to your Dropbox folder and paste it in. (I personally create an “Apps” sub directory) Our work is not yet done. We have 2 more things to take care of. One is the Java Runtime Environment (JRE) that Netbeans depends on, and the other is the configuration of the user directory. Full disclosure: Much of this info is from this post, however it is a bit dated and I have noticed a change or two. Note his version is for a flash drive, and he says it would be too slow for real development, but in our configuration we are using the hard drive.

  1. Java Runtime Enviroment (JRE) – Ther are two choices to this one. Either download and install it on all PCs you plan on using Netbeans on, or we can add it to the Dropbox folder. To do that, after installing navigate to C:\Program Files\Java and copy the jre6 folder to the (dropbox)\Netbeans 6.9 folder.
  2. Make a directory called “NetbeansUserDir” (or anything else you want) in the same directory as your Netbeans directory. In version 6.8, I couldn’t get Netbeans to use a sub directory of the Netbeans folder for this, so I just put it next to the Netbeans folder. Feel free to experiment on your own once things are working. Now it is time to do a bit of editing.
  3. In the Netbeans folder you will find an etc\netbeans.conf file. Open this in your favorite text editor. Unfortunately, the file looks pretty messy due to a lack of (or at least non-windows compatible) line breaks, but we aren’t going to change much. First find netbeans_default_userdir= and make it say netbeans_default_userdir=”..\..\NetbeansUserDir” (or whatever you named it.)
  4. Now find netbeans_jdkome= farther down in the file and change it to read netbeans_jdkhome=”..\jre6″ go ahead and save the file.

 Note: For this tutorial I am actually replacing Netbeans 6.8 with 6.9, and at the end all my projects, settings, etc had carried over to the new install.

Run!

Now you can simply go into Netbeans 6.9\bin and run netbeans.exe. If nothing happens or you get errors, review the netbeans.conf file from step 3 above. If you get the JDK directory wrong Netbeans will prompt you to download and install it. To test the user directory, once Netbeans is open go to help->about and it will list it in the dialog box at the bottom. Feel free to make shortcuts to C:\Dropbox\Netbeans 6.9\bin\netbeans.exe (or wherever you put it) on your desktop/launcher/start menu/etc however I find the best (and synced!) place is just the root of the Dropbox folder.

Cleanup

You can now uninstall Netbeans from your computer to save space and eliminate confusing shortcuts. Note that Netbeans will leave some ‘litter’ behind in the form of .netbeans and .netbeans-registration folders in your user folder. These should be theoretically eliminated if one were to edit the JRE settings that point to the “${HOME}” system property alluded to in the netbeans.conf, however the files are unsubstantial and I have not found where the settings are kept in my limited perusal. Note that if the registration folder is deleted, Netbeans will once again ask you to register the next time you start the program, which will recreate the file. As Dropbox will only be installed on computers you have control over, and all data is on the hard drive anyway, I don’t see a privacy reason to eliminate these files, however if you were doing this on a thumb drive it might be something to look into if you are security conscious.

Going further

Dropbox can be used for many things. I personally use it for quick copying of files from one computer to another as well as hosting a variety of lesser used apps. Any application that does not need to modify the host computer can live entirely in Dropbox and be synced across computers. A good place to start is portableapps.com which also has a menu system (like a secondary start menu) that will work fine in Dropbox to save you hunting for all the program executable.

Linux/Mac

The Netbeans we installed has 2 files in the /bin folder. The second should launch Netbeans with the same path statements we edited earlier in setup. From there you can edit your local Apache settings to change the www root to the xampp/htdocs folder, or link the two folders, or create a sub-domain. I will leave that as an exercise to the reader (Ubuntu 10.04 does not support my video card you see…) but please comment if get it going.

As for Mac, I honestly do not know. Feel free to educate me below! I would love to update this to being entirely cross-platform, and with your help I can.

3 Responses to Develop Anywhere with Dropbox, NetBeans and Xampp