Search |
||
inder's BlogInstalling a Ubuntu Hardy Heron Java Development Environment on a USB flash drivePosted by inder on July 6, 2008 at 12:16 PM PDT
USB flash drives are really cheap these days, so I decided to create a portable environment that contains all my favorite applications, as well as Java IDEs and utilities. This is attractive since I can boot up any computer with this thumb drive, and have the same environment to work with. Besides, it is kind of cool. You would think that this would be as easy as booting from the install disk of Ubuntu, and choosing USB disk as the target drive. Alas, it is not so. Ubuntu will try to install Grub which will be unable to boot from your USB disk. Moreover, I started running into problems with using the same USB disk at different computers. So, I searched around and found some excellent articles at debuntu.org and by Ryan Cloke. Both were written for the prior version 8.04 of Hardy Heron but are still largely appropriate. There were a few typos in the instructions, so I decided to reproduce instructions here with my edits, as well as add instructions related to setting up the Java development environment. Prepare the USB DiskGet a USB disk, at least 1 GB in size. I got an 8GB one since then I dont have to worry about conserving disk space for a while.These instructions assume that you already have a Linux installation to use to prepare the USB linux installation. If you know how to do this with Windows, please share instructions as comments to this blog. The first step is to partition the USB disk using
Scan output for entries similar to this. Disk /dev/sdc: 8017 MB, 8017412096 bytes 255 heads, 63 sectors/track, 974 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xcb527ec4 Device Boot Start End Blocks Id System /dev/sdc1 * 1 95 763056 83 Linux /dev/sdc2 96 974 7060567+ 83 Linux As you can notice, the disk In my case above, I already have the USB disk properly partitioned. But you will need to do the same if you haven't already done so (Note that this will erase ALL the data on the disk, so back up anything important before executing these instructions):
Now we need to format these partitions: sudo mkfs.vfat -F 16 -n UbuntuLive /dev/sdc1 sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdc2 Prepare the Ubuntu InstallationDownload the Hardy Heron 8.04.1 ISO image from Ubuntu website. I chose the 32-bit i386 image (ubuntu-8.04.1-desktop-i386.iso) because it is going to run on almost all CPUs. The first step is to mount the downloaded iso image. sudo mkdir -p /media/iso sudo mount -o loop ubuntu-8.04.1-desktop-i386.iso /media/isoCopy the contents of this image to a temporary directory (/home/inder/hardy-usb in my case): mkdir -p /home/inder/hardy-usb sudo cp -rf casper dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines casper/vmlinuz casper/initrd.gz install/mt86plus /home/inder/hardy-usb/ Next, we will modify this installation to fix some bugs specific to USB disk installation.
cd /home/inder/hardy-usb/ mv isolinux.cfg syslinux.cfg sudo vi syslinux.cfg You should replace the contents of this file with the following: DEFAULT usblive GFXBOOT bootlogo APPEND file=/preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash -- LABEL usblive menu label ^Start Ubuntu and save changes to USB kernel vmlinuz append file=/preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz quiet splash -- LABEL live menu label ^Try Ubuntu without any change to your computer kernel vmlinuz append file=/preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash -- LABEL live-install menu label ^Install Ubuntu kernel vmlinuz append file=/preseed/ubuntu.seed boot=casper only-ubiquity initrd=initrd.gz quiet splash -- LABEL memtest menu label Test ^memory kernel mt86plus append - LABEL hd menu label ^Boot from first hard disk localboot 0x80 append - DISPLAY isolinux.txt TIMEOUT 300 PROMPT 1 F1 f1.txt F2 f2.txt F3 f3.txt F4 f4.txt F5 f5.txt F6 f6.txt F7 f7.txt F8 f8.txt F9 f9.txt F0 f10.txt Save the file, and move on to the next step of fixing another bug in initrd.gz: cd /home/inder/hardy-usb/ mkdir initrd_old cd initrd_old gunzip < ../initrd.gz | cpio -i --make-directories cd scripts sudo vi casper Now, search for "mount ${cowdevice} -t ${cow_fstype} -o rw,noatime,mode=755 /cow". Remove "mode=755". So the line should look like this:
mount ${cowdevice} -t ${cow_fstype} -o rw,noatime /cow || panic "Can not mount $cowdevice on /cow"
After your have modified and saved the casper script, we need to repack the initrd file system. cd .. find ./ | cpio -H newc -o > ../initrdnew cd .. sudo rm initrd.gz sudo mv initrdnew initrd sudo gzip initrd sudo rm -rf initrd_old Copying Ubuntu to the USB disksudo mount /dev/sdc1 /media/usb cd /home/inder/hardy-usb/ sudo cp -rf .disk * /media/usb sudo umount /media/usb Make the disk bootable sudo syslinux -f /dev/sdc1 If you had made the mistake of trying to install Ubuntu directly from the CDROM, you will need to get rid of Grub. You can do so by installing Lilo to overwrite MBR: sudo lilo -M /dev/sdc Yay, you have the USB disk with Ubuntu. Now reboot the PC with the USB disk plugged in. You may have to select the bios setting to boot from the USB. On my laptop, I have to press F12, and on my home desktop, I have to press F11. You can also make the USB disk as a higher priority boot device. Configuring the Ubuntu InstallationBoot up your PC from the USB disk. The system will boot into the default Ubuntu account. Open a terminal and run Create a user account for yourself by using the System|Administration|Users and Groups menu. Ensure that in the create account screen, you have given this user the permissions to administer the system. Disable the automatic login to the ubuntu user. Select System|Administration|Login Window menu. Select the Security tab, and unselect "Enable Automatic Login" and "Enable Timed Login". Note that you can still go to the ubuntu user by typing Ctrl-Alt-F1. I could not figure out a simple way to prevent the system from automatically logging in ubuntu user. If you know how to do this, please share that as comments to this blog. Prevent Ubunutu from hibernating. Launch Configure Ubuntu to allow software from multiple repositories. Go to System|Administration|Software Sources Menu. Under the Ubuntu tab, choose "Community-maintained Open Source Software (universe)". Also, choose "Software restricted by copyright and legal issues (multiverse)". I also unselected the "Source code" option hoping that it may save me precious space on my USB disk by avoiding source-code for programs. At this time, you may want to update your system with the latest versions of the various packages from the System | Administration | Update Manager menu. However, be selective in updating especially if you have a USB disk less than 2GB in size. The reason being that all the new packages that you install will be installed on your second partition, while the original packages will remain on the first partition. You may still want to upgrade commonly-used packages such as firefox. Also, dont bother trying to remove any of the unused packages since, again, they are on the first partition, and will not really free up any space on the second partition. Install flash player for firefox. This is useful if you want to play YouTube videos.
You may also want Firefox configured such that it does not use the USB disk for storing caches. For that, start firefox, and type Installing JavaUbuntu does not come pre-installed with Java. Unfortunately, there are some bugs in Java packaqes, so just using apt-get will give you some weird errors regarding libjli.so. Here are steps to fix this problem (instructions adapated from swik.net): sudo su // switch to administrator role apt-get install sun-java6-jdk ln -s / /cow export LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun/jre/lib/i386/jli dpkg --configure -a Run javac --version to ensure that the JDK installed correctly. You can also install openjdk-6-jdk package instead. In that case, make sure that you adjust LD_LIBRARY_PATH accordingly before running dpkg. Install other useful tools such as subversion and maven: sudo apt-get install maven2 sudo apt-get install subversion Installing Eclipse GanymedeDownload Eclipse from eclipse.org or issue the following command from command-line: wget http://ganymede-mirror1.eclipse.org/technology/epp/downloads/release/gan... tar xvfz eclipse-jee-ganymede-linux-gtk.tar.gz sudo mv eclipse /opt/ You can now run eclipse from /opt/eclipse/eclipse. I also installed a short-cut for Eclipse on my menu-bar. You can choose the icon images for Eclipse from Once you have a configuration you are pleased with, you may want to create a backup so that you can restore it in case anything goes wrong. I did this by plugging-in the USB disk in my other linux desktop, and then using the sudo dd if=/dev/sdc1 of=/home/inder/hardy-working-disk1.iso sudo dd if=/dev/sdc2 of=/home/inder/hardy-working-disk2.iso You can restore this by issuing the dd commands in reverse: sudo dd if=/home/inder/hardy-working-disk1.iso of=/dev/sdc1 sudo dd if=/home/inder/hardy-working-disk2.iso of=/dev/sdc2 That concludes this rather long blog. It took me several installs and reinstalls to get it right, but the results are worth it. I am enjoying my USB linux installation and using it to write this blog. Have you installed linux on USB disks as well? If so, share your experiences as comments to this blog. Thanks for reading. »
Related Topics >>
Linux Comments
Comments are listed in date ascending order (oldest first)
Submitted by awaisbajwa on Tue, 2008-07-08 06:14.
nice one.
Submitted by vjsjvm on Mon, 2008-07-07 11:35.
I am glad to see this type of article on Java forum.
I have been doing this for some time now and found the following site indispensable!
http://www.pendrivelinux.com/
The whole purpose of this site is 'Easily run Linux from a portable USB device'!
Do check it out.
Submitted by keeskuip on Tue, 2008-07-08 09:48.
Good story!
Coincidentally last weekend I gave it a try (to install ubuntu on an epia) and it almost worked.
A few questions:
1. After the step 'Make disk bootable' you switch from sdc to sdb. I assume this is a mistake?
2. Why do you need sdc2? It doesn't look like you use it and I would like to keep my flashdrive vfat.
Submitted by inder on Tue, 2008-07-08 11:00.
Yes, it should be sdc (I have updated the instructions).
sdc2 is needed because that is where the OS is booted into. sdc1 just keeps the Live CD image, which is read-only. All of your OS updates, and user home directories, etc are kept on sdc2.
Installing a Ubuntu Hardy Heron Java Development Environment on a USB flash drivePosted by inder on July 6, 2008 at 12:16 PM PDT
USB flash drives are really cheap these days, so I decided to create a portable environment that contains all my favorite applications, as well as Java IDEs and utilities. This is attractive since I can boot up any computer with this thumb drive, and have the same environment to work with. Besides, it is kind of cool. You would think that this would be as easy as booting from the install disk of Ubuntu, and choosing USB disk as the target drive. Alas, it is not so. Ubuntu will try to install Grub which will be unable to boot from your USB disk. Moreover, I started running into problems with using the same USB disk at different computers. So, I searched around and found some excellent articles at debuntu.org and by Ryan Cloke. Both were written for the prior version 8.04 of Hardy Heron but are still largely appropriate. There were a few typos in the instructions, so I decided to reproduce instructions here with my edits, as well as add instructions related to setting up the Java development environment. Prepare the USB DiskGet a USB disk, at least 1 GB in size. I got an 8GB one since then I dont have to worry about conserving disk space for a while.These instructions assume that you already have a Linux installation to use to prepare the USB linux installation. If you know how to do this with Windows, please share instructions as comments to this blog. The first step is to partition the USB disk using
Scan output for entries similar to this. Disk /dev/sdc: 8017 MB, 8017412096 bytes 255 heads, 63 sectors/track, 974 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xcb527ec4 Device Boot Start End Blocks Id System /dev/sdc1 * 1 95 763056 83 Linux /dev/sdc2 96 974 7060567+ 83 Linux As you can notice, the disk In my case above, I already have the USB disk properly partitioned. But you will need to do the same if you haven't already done so (Note that this will erase ALL the data on the disk, so back up anything important before executing these instructions):
Now we need to format these partitions: sudo mkfs.vfat -F 16 -n UbuntuLive /dev/sdc1 sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdc2 Prepare the Ubuntu InstallationDownload the Hardy Heron 8.04.1 ISO image from Ubuntu website. I chose the 32-bit i386 image (ubuntu-8.04.1-desktop-i386.iso) because it is going to run on almost all CPUs. The first step is to mount the downloaded iso image. sudo mkdir -p /media/iso sudo mount -o loop ubuntu-8.04.1-desktop-i386.iso /media/isoCopy the contents of this image to a temporary directory (/home/inder/hardy-usb in my case): mkdir -p /home/inder/hardy-usb sudo cp -rf casper dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines casper/vmlinuz casper/initrd.gz install/mt86plus /home/inder/hardy-usb/ Next, we will modify this installation to fix some bugs specific to USB disk installation.
cd /home/inder/hardy-usb/ mv isolinux.cfg syslinux.cfg sudo vi syslinux.cfg You should replace the contents of this file with the following: DEFAULT usblive GFXBOOT bootlogo APPEND file=/preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash -- LABEL usblive menu label ^Start Ubuntu and save changes to USB kernel vmlinuz append file=/preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz quiet splash -- LABEL live menu label ^Try Ubuntu without any change to your computer kernel vmlinuz append file=/preseed/ubuntu.seed boot=casper initrd=initrd.gz quiet splash -- LABEL live-install menu label ^Install Ubuntu kernel vmlinuz append file=/preseed/ubuntu.seed boot=casper only-ubiquity initrd=initrd.gz quiet splash -- LABEL memtest menu label Test ^memory kernel mt86plus append - LABEL hd menu label ^Boot from first hard disk localboot 0x80 append - DISPLAY isolinux.txt TIMEOUT 300 PROMPT 1 F1 f1.txt F2 f2.txt F3 f3.txt F4 f4.txt F5 f5.txt F6 f6.txt F7 f7.txt F8 f8.txt F9 f9.txt F0 f10.txt Save the file, and move on to the next step of fixing another bug in initrd.gz: cd /home/inder/hardy-usb/ mkdir initrd_old cd initrd_old gunzip < ../initrd.gz | cpio -i --make-directories cd scripts sudo vi casper Now, search for "mount ${cowdevice} -t ${cow_fstype} -o rw,noatime,mode=755 /cow". Remove "mode=755". So the line should look like this:
mount ${cowdevice} -t ${cow_fstype} -o rw,noatime /cow || panic "Can not mount $cowdevice on /cow"
After your have modified and saved the casper script, we need to repack the initrd file system. cd .. find ./ | cpio -H newc -o > ../initrdnew cd .. sudo rm initrd.gz sudo mv initrdnew initrd sudo gzip initrd sudo rm -rf initrd_old Copying Ubuntu to the USB disksudo mount /dev/sdc1 /media/usb cd /home/inder/hardy-usb/ sudo cp -rf .disk * /media/usb sudo umount /media/usb Make the disk bootable sudo syslinux -f /dev/sdc1 If you had made the mistake of trying to install Ubuntu directly from the CDROM, you will need to get rid of Grub. You can do so by installing Lilo to overwrite MBR: sudo lilo -M /dev/sdc Yay, you have the USB disk with Ubuntu. Now reboot the PC with the USB disk plugged in. You may have to select the bios setting to boot from the USB. On my laptop, I have to press F12, and on my home desktop, I have to press F11. You can also make the USB disk as a higher priority boot device. Configuring the Ubuntu InstallationBoot up your PC from the USB disk. The system will boot into the default Ubuntu account. Open a terminal and run Create a user account for yourself by using the System|Administration|Users and Groups menu. Ensure that in the create account screen, you have given this user the permissions to administer the system. Disable the automatic login to the ubuntu user. Select System|Administration|Login Window menu. Select the Security tab, and unselect "Enable Automatic Login" and "Enable Timed Login". Note that you can still go to the ubuntu user by typing Ctrl-Alt-F1. I could not figure out a simple way to prevent the system from automatically logging in ubuntu user. If you know how to do this, please share that as comments to this blog. Prevent Ubunutu from hibernating. Launch Configure Ubuntu to allow software from multiple repositories. Go to System|Administration|Software Sources Menu. Under the Ubuntu tab, choose "Community-maintained Open Source Software (universe)". Also, choose "Software restricted by copyright and legal issues (multiverse)". I also unselected the "Source code" option hoping that it may save me precious space on my USB disk by avoiding source-code for programs. At this time, you may want to update your system with the latest versions of the various packages from the System | Administration | Update Manager menu. However, be selective in updating especially if you have a USB disk less than 2GB in size. The reason being that all the new packages that you install will be installed on your second partition, while the original packages will remain on the first partition. You may still want to upgrade commonly-used packages such as firefox. Also, dont bother trying to remove any of the unused packages since, again, they are on the first partition, and will not really free up any space on the second partition. Install flash player for firefox. This is useful if you want to play YouTube videos.
You may also want Firefox configured such that it does not use the USB disk for storing caches. For that, start firefox, and type Installing JavaUbuntu does not come pre-installed with Java. Unfortunately, there are some bugs in Java packaqes, so just using apt-get will give you some weird errors regarding libjli.so. Here are steps to fix this problem (instructions adapated from swik.net): sudo su // switch to administrator role apt-get install sun-java6-jdk ln -s / /cow export LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun/jre/lib/i386/jli dpkg --configure -a Run javac --version to ensure that the JDK installed correctly. You can also install openjdk-6-jdk package instead. In that case, make sure that you adjust LD_LIBRARY_PATH accordingly before running dpkg. Install other useful tools such as subversion and maven: sudo apt-get install maven2 sudo apt-get install subversion Installing Eclipse GanymedeDownload Eclipse from eclipse.org or issue the following command from command-line: wget http://ganymede-mirror1.eclipse.org/technology/epp/downloads/release/gan... tar xvfz eclipse-jee-ganymede-linux-gtk.tar.gz sudo mv eclipse /opt/ You can now run eclipse from /opt/eclipse/eclipse. I also installed a short-cut for Eclipse on my menu-bar. You can choose the icon images for Eclipse from Once you have a configuration you are pleased with, you may want to create a backup so that you can restore it in case anything goes wrong. I did this by plugging-in the USB disk in my other linux desktop, and then using the sudo dd if=/dev/sdc1 of=/home/inder/hardy-working-disk1.iso sudo dd if=/dev/sdc2 of=/home/inder/hardy-working-disk2.iso You can restore this by issuing the dd commands in reverse: sudo dd if=/home/inder/hardy-working-disk1.iso of=/dev/sdc1 sudo dd if=/home/inder/hardy-working-disk2.iso of=/dev/sdc2 That concludes this rather long blog. It took me several installs and reinstalls to get it right, but the results are worth it. I am enjoying my USB linux installation and using it to write this blog. Have you installed linux on USB disks as well? If so, share your experiences as comments to this blog. Thanks for reading. »
Related Topics >>
Linux Comments
Comments are listed in date ascending order (oldest first)
Submitted by vjsjvm on Mon, 2008-07-07 11:35.
I am glad to see this type of article on Java forum.
I have been doing this for some time now and found the following site indispensable!
http://www.pendrivelinux.com/
The whole purpose of this site is 'Easily run Linux from a portable USB device'!
Do check it out.
Submitted by keeskuip on Tue, 2008-07-08 09:48.
Good story!
Coincidentally last weekend I gave it a try (to install ubuntu on an epia) and it almost worked.
A few questions:
1. After the step 'Make disk bootable' you switch from sdc to sdb. I assume this is a mistake?
2. Why do you need sdc2? It doesn't look like you use it and I would like to keep my flashdrive vfat.
Submitted by inder on Tue, 2008-07-08 11:00.
Yes, it should be sdc (I have updated the instructions).
sdc2 is needed because that is where the OS is booted into. sdc1 just keeps the Live CD image, which is read-only. All of your OS updates, and user home directories, etc are kept on sdc2.
Teaching Maven2 to use multiple source directoriesPosted by inder on May 22, 2008 at 4:37 PM PDT
For project Gson, which is a library to convert Java objects to JSON and vice-versa, we use Maven2. We are also using Javacc to generate a JSON parser, but we had to modify the generated source-code to hide the generated classes. This meant that we had two source directories, one under
src/main/java and another under src/generated/java. I tried hard to find out how to convince maven to use both the directories for compilation, but most websites really advise you to use multiple modules. In maven1.x, there seemed to be some support for it through maven:addPath but nothing in Maven2.
Finally, I did find a solution for Maven2 in this and this thread, and thought I would share it here. Essentially, you define an include section in your build section of
See pom.xml of Gson for more details. Have you run into a similar issue? Did you also find the answer hard to search? How did you solve this problem? Share your thoughts as comments to this blog. Thanks for reading. »
Related Topics >>
Java Tools Comments
Comments are listed in date ascending order (oldest first)
Submitted by brianf on Thu, 2008-05-22 19:40.
On second thought, the compiler config above may cause problems with other plugins such as IDE integrations. The build-helper-maven-plugin really is the correct way. I wrote more about it here.
Submitted by brianf on Thu, 2008-05-22 18:40.
This is one way to accomplish the goal, however the build-helper-maven-plugin is the generally accepted way to add additional source folders to a build. It also lets you do some things like attach random files to be installed/deployed, etc.
--Brian Apache Maven PMC http://blogs.sonatype.com/brian Teaching Maven2 to use multiple source directoriesPosted by inder on May 22, 2008 at 4:37 PM PDT
For project Gson, which is a library to convert Java objects to JSON and vice-versa, we use Maven2. We are also using Javacc to generate a JSON parser, but we had to modify the generated source-code to hide the generated classes. This meant that we had two source directories, one under
src/main/java and another under src/generated/java. I tried hard to find out how to convince maven to use both the directories for compilation, but most websites really advise you to use multiple modules. In maven1.x, there seemed to be some support for it through maven:addPath but nothing in Maven2.
Finally, I did find a solution for Maven2 in this and this thread, and thought I would share it here. Essentially, you define an include section in your build section of
See pom.xml of Gson for more details. Have you run into a similar issue? Did you also find the answer hard to search? How did you solve this problem? Share your thoughts as comments to this blog. Thanks for reading. »
Related Topics >>
Java Tools Comments
Comments are listed in date ascending order (oldest first)
Submitted by brianf on Thu, 2008-05-22 19:40.
On second thought, the compiler config above may cause problems with other plugins such as IDE integrations. The build-helper-maven-plugin really is the correct way. I wrote more about it here.
Submitted by brianf on Thu, 2008-05-22 18:40.
This is one way to accomplish the goal, however the build-helper-maven-plugin is the generally accepted way to add additional source folders to a build. It also lets you do some things like attach random files to be installed/deployed, etc.
--Brian Apache Maven PMC http://blogs.sonatype.com/brian NetBeans module for Java SDK for Google Checkout APIs releasedPosted by inder on August 30, 2007 at 3:22 PM PDT
Do you write Web applications for selling things on the Web? Have you considered integrating Google Checkout to enhance the buying experience on your Website? Besides providing an easy Web-based console for merchants, Google Checkout also provides a powerful REST and XML based API to enable merchants to integrate their backend systems for order processing.
We provide convenient libraries and sample code for various languages including Java, C#, Perl and PHP. But for Java, we go the extra mile. We provide an open-source project Google Checkout Java SDK that provides convenient Java-based handlers to deal with the XML messages sent by the Google Checkout APIs notifications and callbacks. Of course, tools can make this process even easier. So, I am happy to announce the public availability of the first version of a NetBeans module that provides a wizard-driven interface to integrate the Checkout SDK in any Web project. Here are the instructions to download and install this plugin module in your NetBeans IDE. We hope to continue enhancing this module based on developer feedback. So, share your experiences with Google Checkout APIs, SDK or this module as comments to this blog. Thanks for reading. »
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
NetBeans module for Java SDK for Google Checkout APIs releasedPosted by inder on August 30, 2007 at 3:22 PM PDT
Do you write Web applications for selling things on the Web? Have you considered integrating Google Checkout to enhance the buying experience on your Website? Besides providing an easy Web-based console for merchants, Google Checkout also provides a powerful REST and XML based API to enable merchants to integrate their backend systems for order processing.
We provide convenient libraries and sample code for various languages including Java, C#, Perl and PHP. But for Java, we go the extra mile. We provide an open-source project Google Checkout Java SDK that provides convenient Java-based handlers to deal with the XML messages sent by the Google Checkout APIs notifications and callbacks. Of course, tools can make this process even easier. So, I am happy to announce the public availability of the first version of a NetBeans module that provides a wizard-driven interface to integrate the Checkout SDK in any Web project. Here are the instructions to download and install this plugin module in your NetBeans IDE. We hope to continue enhancing this module based on developer feedback. So, share your experiences with Google Checkout APIs, SDK or this module as comments to this blog. Thanks for reading. »
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
Pet peeve with the Java 1.5 enhanced for loopPosted by inder on May 24, 2007 at 4:15 PM PDT
I love the enhanced for loop construct introduced in Java 1.5. It makes the code look clean, and saves us from dealing with iterators or array indices. But since it is essentially syntactic sugar, it does create iterators behind the scenes as necessary. This can result in insidious bugs since if the passed collection or the array is null, your for loop will throw a NullPointerException. Here is an example:
When this program is run, it will throw a null pointer exception. I think it would have been better if the for loop did a null pointer check on the collection before trying to iterate over it. Granted, it will have a little bit of overhead, but I think the cost is justified because it is really common for people to not check for null values before invoking the for loop. I dont expect the semantics to get changed now because of backward compatibility concerns, so dont hold your breath expecting a change. But still, what do you think? Did the language designers make a mistake? Share your thoughts as comments to the blog. »
Related Topics >>
J2SE Comments
Comments are listed in date ascending order (oldest first)
Pet peeve with the Java 1.5 enhanced for loopPosted by inder on May 24, 2007 at 4:15 PM PDT
I love the enhanced for loop construct introduced in Java 1.5. It makes the code look clean, and saves us from dealing with iterators or array indices. But since it is essentially syntactic sugar, it does create iterators behind the scenes as necessary. This can result in insidious bugs since if the passed collection or the array is null, your for loop will throw a NullPointerException. Here is an example:
When this program is run, it will throw a null pointer exception. I think it would have been better if the for loop did a null pointer check on the collection before trying to iterate over it. Granted, it will have a little bit of overhead, but I think the cost is justified because it is really common for people to not check for null values before invoking the for loop. I dont expect the semantics to get changed now because of backward compatibility concerns, so dont hold your breath expecting a change. But still, what do you think? Did the language designers make a mistake? Share your thoughts as comments to the blog. »
Related Topics >>
J2SE Comments
Comments are listed in date ascending order (oldest first)
Using Google Checkout SDK with GlassfishPosted by inder on May 21, 2007 at 11:28 PM PDT
The Checkout SDK provides a library jar and an XML configuration file that you will need to embed in your Web application. You can then configure your action handlers that will receive notification of various order processing events from Google as a user places an order. Here are the steps that you will need to follow:
That is it! Try it out today, and share your experiences as comments to this blog. We will be try our best to improve the checkout SDK to enable easy implementation by your Web applications. Thanks for reading. »
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
Using Google Checkout SDK with GlassfishPosted by inder on May 21, 2007 at 11:28 PM PDT
The Checkout SDK provides a library jar and an XML configuration file that you will need to embed in your Web application. You can then configure your action handlers that will receive notification of various order processing events from Google as a user places an order. Here are the steps that you will need to follow:
That is it! Try it out today, and share your experiences as comments to this blog. We will be try our best to improve the checkout SDK to enable easy implementation by your Web applications. Thanks for reading. »
Related Topics >>
Java Enterprise Comments
Comments are listed in date ascending order (oldest first)
|
||
|