Somehow I managed to get internet connection on my new Ubuntu installation. Im now willing to get all the mundane java stuff that I have been doing with windows to be done in Ubuntu. I have a couple of questions here. Is there any guide or any sort of knowhow where I could get information on doing this. I tried google and the support site from my eclipse, but I was not able to find suitable documentation. Any suggestions?
1) Use the Package Manager to locate and install Java-related stuff (MyEclipse will not be in this list because it is not free)
2) Download and install the stuff yourself
Personally, I always do #2. This includes the JDKs (download and run the *.bin), Eclipse (download and unpack), Tomcat, JBoss AS, Ant, Maven, et.c, etc, etc. I put the JDK at /usr/java (force of habit from Fedora) and the other stuff in /opt (after I change the owner).
1) JDK installation
Download the *.bin (not the *.rpm.bin file) file for Linux from Sun's web site. http://java.sun.com/javase/downloads/?intcmp=1281 Make sure you get the JDK, not the JRE, and you need only the plain JDK, not the one with Java EE or with NetBeans.
I download it to my desktop.
Then open a command prompt and do (warning: these are from memory, substitute xxx with your info):
You will now have a directory /usr/java/jdk1.6.0_13. Note that you must run the *.bin file form the /usr/java directory - the *.bin creates its directory structure in the directory from which it is run.
At this point I usually create some symbolic links to make life a little easier:
You can also "ln" jar, javac or others as you like.
Then in my .bashrc (or profile file) I place:
Later, when i upgrade to JDK 6u14, I simply change the /usr/java/default link to reference /usr/java/jdk1.6.0_14 and everything else is automatically updated because everything else references /usr/java/default.
2) Install Eclipse
Download Eclipse for Java EE Developers. I download to my desktop. Then I change ownership of /opt to myself and extract the Eclipse tar.gz file into /opt so that I end up with /opt/eclipse. To run it, run /opt/eclipse/eclipse. You can also add a menu item to KDE or Gnome to run it.
For other things (Ant, Tomcat, JBoss AS) I follow the same pattern as for Eclipse.
I tried out your way of getting jdk installed. But I did not understand what xxx means?? I guess I missed something here and the installation was successful but it did not install in the location where I wanted.
Another question is where can I find .bashrc? And do I use it to set my Java_Home?
Peter, thanks for that rundown! I like the way you organize things, especially the java install. That's a very clean way of doing it.
Jothi, Peter is using the Xs to substitute for things that will different on each system. He used xxx to represent your user name. On my system, I have /home/greg, Peter probably has /home/peter, and you probably have /home/jothi. When you download the java installation "bin" file, it's going to be somewhere in your home folder, probably in desktop. He's using xxxx just to represent the exact file name of the java bin file you downloaded to install. It's going to change just slightly to reflect the actual version and release number. Does that help? Good luck!
I like the way you organize things, especially the java install.
I'd like to take credit for this but can't. The *.rpm.bin download from Sun's web site builds the structure that I outlined. My first foray into Linux was with SUSE, and later with RHEL and then Fedora, and all those systems use RPM for package management. And I got used to where they placed the JDK. I hate the fact that when I install using the package manager that I never find where everything gets hidden, hence my aversion to using the package manager for most Java-related items
where can I find .bashrc?
In Linux, and file that starts with a dot is a hidden file. In the file manager change the options to display hidden files. Or on the command line use 'ls -al' to display hidden files (I set my 'dir' alias to that ls command).
it did not install in the location where I wanted.
As I pointed out, you have to open a terminal window and 'cd' to the /usr/java directory, and from there run the install. The installer will unpack the JDK into the current directory (ask me how many times I accidentally installed into /home/peter/Desktop...). (Shoot, I just installed Ubuntu 9.04, along with Windows 7, on my laptop yesterday and installed the JDK, I should have captured the terminal output and pasted it here.)
Thanks Peter for your response. I guess the third time I got it correctly installed. But later when I opened a terminal and said javac, it did not show anything. It told me that I have to download java from so and so location showing all possible jvm implementations. Can you please tell me how you have set your java home and especially how to edit the .bashrc file?
Are you saving that running, for example, "java -version" works, but running, for example, "javac -version" does not work? If so, either you did not run 'ln -s' to set of a symbolic link for javac, or you set it up incorrectly.
I have read elsewhere that you can simply create a .bashrc_profile file in your home directory and bash will automatically read it. That has never worked for me. But I like the idea of having my settings in a separate file. So I edited .bashrc and add these lines at the very end of the file:
Then I created .bash_profile and added these lines:
Hey Jothi, how's it going with MyEclipse? I had a pretty bad time with it actually. I tried an automatic update, and that failed hard. I couldn't even open Java files any more. So I nuked that version of Eclipse, and just downloaded their full package with Eclipse plus their tools. That worked better except it killed the internal web browser until I updated Subversion, which doesn't make a lot of sense. After that it seemed to work though.
Oh, OK. Well, keep us up to date. I've also just started using Kubuntu for the first time, but I learned Unix many years ago in school so that helps. I've hit some problems, but mostly it works well. The installation is much easier than Windows, and so far it's been plug and play with all my hardware. The MyEclipse problems seem to be more an issue of MyEclipse than the platform, but I haven't tried it on Windows so I can't be sure.