13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

168Chapter 6The IBM Developer Kit for <strong>Linux</strong>, Java 2 Technology Editi<strong>on</strong>6.2USE LINUX FEATURES TO MAKE MULTIPLE JAVA SDKSPLAY NICELY TOGETHERWe did not spend much time discussing the installati<strong>on</strong> of Java <strong>on</strong> your <strong>Linux</strong>system in previous chapter. In fact, we did not discuss it at all. This is becausethe installati<strong>on</strong> instructi<strong>on</strong>s that come with the SDK are more than adequateif you wish <strong>on</strong>ly to install a single Java SDK. But what if you want to install,say, both the Sun Java SDK and the IBM Java SDK? Then things get a bit moreinteresting.We’re going to review the c<strong>on</strong>cept of filesystem links, and how they work<strong>on</strong> <strong>Linux</strong>. While it may seem odd to discuss them here, we’ll be using links toswitch gracefully between different Java installati<strong>on</strong>s. Links are a powerfulfeature in <strong>Linux</strong> filesystems, and switching SDKs is a good applicati<strong>on</strong> thereof.If you’re already familiar with links, skip ahead to Secti<strong>on</strong> 6.2.2.6.2.1 LinksA link is simply a name attached to a collecti<strong>on</strong> of data—that is, to a file. Inother words, every file has <strong>on</strong>e set of data and at least <strong>on</strong>e link (a name). But afile may have more than <strong>on</strong>e link. In other words, two different filenames maypoint to the same data. When you do this, you appear to have two copies ofthe file, but a change to <strong>on</strong>e also changes the other. Deleting <strong>on</strong>e, however,does not delete the other. It merely deletes the link. The file itself is <strong>on</strong>lydeleted when the last link is g<strong>on</strong>e.6.2.1.1 Hard LinksLinks come in two flavors: hard and symbolic. A hard link looks like a file inand of itself. Let’s show you a hard link, before and after.$ ls -latotal 12drwxrwxr-x 2 mschwarz mschwarz 4096 Jul 8 10:11 .drwx------ 50 mschwarz mschwarz 4096 Jul 8 10:11 ..-rw-rw-r-- 1 mschwarz mschwarz 45 Jul 8 10:11 sample$ cat sampleThis is a samplefile to dem<strong>on</strong>stratelinks.$

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!