Setting up Ubuntu 12.04 for Java development
In this post I will describe steps I have followed after fresh install of new Ubuntu 12.04 LTS. Linux is great environment for Java development and I am using for several years now. In my last work I had to maintain projects running on different versions of Java. This instruction gives some hints how you can deal with this situation effectively. Moreover I describe how to change GUI outline in Eclipse to be more compact using GTK configuration files.JDK
I prefer installing Java manually. As I mentioned before I need to have several versions of Java including 1.5, 1.6 and 1.7. First step is to download required files from oracle site:http://www.oracle.com/technetwork/java/javase/downloads
Choose Linux files for your OS architecture (i586 for 32-bit version of Ubuntu and x64 for 64-bit version). You should download files with .bin extension (for 1.5 and 1.6 JDK versions) or .tar.gz (1.7 JDK). After downloading, you should have following files in Downloads directory:
stanislaw@latitude:~/Downloads$ ls -l total 212888 -rw-rw-r-- 1 stanislaw stanislaw 49760685 Jun 8 14:42 jdk-1_5_0_22-linux-i586.bin -rw-rw-r-- 1 stanislaw stanislaw 85292206 Jun 8 14:43 jdk-6u31-linux-i586.bin -rw-rw-r-- 1 stanislaw stanislaw 82927766 Jun 8 14:37 jdk-7u4-linux-i586.tar.gzWe will install all jdk's in /opt/java directory. First create directory:
sudo mkdir /opt/javaNow extract jdk-7 file and simply move it do /opt/java directory:
stanislaw@latitude:~/Downloads$ tar zxvf jdk-7u4-linux-i586.tar.gz stanislaw@latitude:~/Downloads$ sudo mv jdk1.7.0_04/ /opt/javaTo install jdk 1.5 and 1.6 first make bin files executable with chmod command:
stanislaw@latitude:~/Downloads$ chmod +x jdk-1_5_0_22-linux-i586.bin jdk-6u31-linux-i586.binNow run this executables (you will be shown license agreement; press q and confirm it by typing yes):
stanislaw@latitude:~/Downloads$ ./jdk-1_5_0_22-linux-i586.bin ... stanislaw@latitude:~/Downloads$ ./jdk-6u31-linux-i586.bin ...Right now 1.5 and 1.6 JDK are in Downloads directory. Move them to /opt/java:
stanislaw@latitude:~/Downloads$ sudo mv jdk1.5.0_22/ /opt/java/ stanislaw@latitude:~/Downloads$ sudo mv jdk1.6.0_31/ /opt/java/Create symbolic links in /opt/java directory. This will simplify updating process to changing particular symbolic link.
stanislaw@latitude:~/Downloads$ cd /opt/java/ stanislaw@latitude:/opt/java$ sudo ln -s jdk1.5.0_22 jdk-1.5 stanislaw@latitude:/opt/java$ sudo ln -s jdk1.6.0_31/ jdk-1.6 stanislaw@latitude:/opt/java$ sudo ln -s jdk1.7.0_04/ jdk-1.7Now it is time to set up java, javac and java plugin. It is best done with update-alternatives utility program. More information about this setup can be found https://sites.google.com/site/easylinuxtipsproject/java. Please note usage of paths to symbolic links created in previous step.
stanislaw@latitude:/opt/java$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk-1.5/bin/java" 2 stanislaw@latitude:/opt/java$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk-1.6/bin/java" 1 stanislaw@latitude:/opt/java$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk-1.7/bin/java" 3 stanislaw@latitude:/opt/java$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/java/jdk-1.7/bin/javac" 3 update-alternatives: using /opt/java/jdk-1.7/bin/javac to provide /usr/bin/javac (javac) in auto mode. stanislaw@latitude:/opt/java$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/java/jdk-1.6/bin/javac" 2 stanislaw@latitude:/opt/java$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/java/jdk-1.5/bin/javac" 1 sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/opt/java/jdk-1.6/jre/lib//i386/libnpjp2.so" 1Last step is setting JAVA_HOME environment variable in .bashrc. Simply add this line at the end of file, to keep java 1.6 as default. Please note that we do not need to set PATH variable, because we used update-alternatives utility to setup /usr/bin/java symbolic link. When I need to work with different version of Java, I simply override default JAVA_HOME value for specific application, i.e. JBoss AS.
export JAVA_HOME=/opt/java/jdk-1.6
Eclipse
Download Linux version, extract it, and move to /opt directory:stanislaw@latitude:~/Downloads$ tar zxvf eclipse-jee-indigo-SR2-linux-gtk.tar.gz stanislaw@latitude:~/Downloads$ sudo mv eclipse /opt/eclipseApplication should be ready to run with default executable /opt/eclipse/eclipse. In gtk environment spacing between GUI components seam to be to big. This can be hopefully fixed by customized gtk configuration based on this blog post. One thing I have added, is tool tip background and foreground configuration, to make it visible (see bug report).
stanislaw@latitude:/opt/eclipse$ cat eclipse-gtkrc style "gtkcompact" { font_name="Sans 9" GtkButton::default_border={0,0,0,0} GtkButton::default_outside_border={0,0,0,0} GtkButtonBox::child_min_width=0 GtkButtonBox::child_min_heigth=0 GtkButtonBox::child_internal_pad_x=0 GtkButtonBox::child_internal_pad_y=0 GtkMenu::vertical-padding=1 GtkMenuBar::internal_padding=0 GtkMenuItem::horizontal_padding=4 GtkToolbar::internal-padding=0 GtkToolbar::space-size=0 GtkOptionMenu::indicator_size=0 GtkOptionMenu::indicator_spacing=0 GtkPaned::handle_size=4 GtkRange::trough_border=0 GtkRange::stepper_spacing=0 GtkScale::value_spacing=0 GtkScrolledWindow::scrollbar_spacing=0 GtkExpander::expander_size=10 GtkExpander::expander_spacing=0 GtkTreeView::vertical-separator=0 GtkTreeView::horizontal-separator=0 GtkTreeView::expander-size=8 GtkTreeView::fixed-height-mode=TRUE GtkWidget::focus_padding=0 } class "GtkWidget" style "gtkcompact" style "gtkcompactextra" { xthickness=0 ythickness=0 } class "GtkButton" style "gtkcompactextra" class "GtkToolbar" style "gtkcompactextra" class "GtkPaned" style "gtkcompactextra" style "tooltip" { bg[NORMAL] = "#FFFFFF" fg[NORMAL] = "#000000" } widget "gtk-tooltips" style "tooltip"In order to override gtk configuration for eclipse only, it is most convenient to prepare additional script eclipse.sh with GTK2_RC_FILES environment variable set.
#!/bin/sh export GTK2_RC_FILES=/opt/eclipse/eclipse-gtkrc /opt/eclipse/eclipseLast step is to add launch icon. This can be done in several ways described here. I prefer method with manual creation of .desktop file. It can be easily used to add launch icon for any other application installed this way.
stanislaw@latitude:~$ cat /usr/share/applications/eclipse.desktop [Desktop Entry] Name=Eclipse Exec=/opt/eclipse/eclipse.sh Icon=/opt/eclipse/icon.xpm Type=Application StartupNotify=true Categories=Development
Other
Installing other java development software like maven, ant is simply done by extracting downloaded zip archives (I personally always use /opt directory) and setting specific environment variables like PATH and ANT_HOME. During my fresh install I installed additionally following packages:# package libsvn-java is required by subclipse plugin sudo apt-get install libsvn-java # version control apt-get install git svn # my favorite terminal editor sudo apt-get install vim # MS fonts sudo apt-get install ttf-mscorefonts-installer # testing frontend configuration for production environment with apache apt-get install apache2 # ... and many more
I had a look at some Java examples at java-tips.org that were worth noticing, and they helped learning fundamentals of Java programming practically.
ReplyDeleteI learned installing Java successfully and created my first mobile app a few days ago, and it was truly a fun experience. I did it under the guidance of Java experts.
ReplyDeleteI’m really impressed with your blog article, such great & useful knowledge you mentioned here..Get more Java Training in Marathahalli
ReplyDeletePython Training in Marathahalli
And indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had
ReplyDeleteJava Training in Bangalore|
Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
ReplyDeleteBesant Technologies
• I and my friends were going through the nice, helpful tips from the blog then the sudden came up with an awful suspicion I never expressed respect to the website owner for those secrets. AWS Training in Bangalore
ReplyDeleteI wish to show thanks to you just for bailing me out of this particular
ReplyDeletetrouble.As a result of checking through the net and meeting
techniques that were not productive, I thought my life was done.
Selenium Training in Bangalore
Hello! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done an outstanding job.
ReplyDeleteJava Training in Bangalore
Much obliged for one superb posting! I appreciated understanding it; you are an extraordinary creator. I will make a point to bookmark your blog and may return sometime in the not so distant future. I need to energize that you proceed with your extraordinary posts, have a pleasant end of the week!... Java Training in Chennai
ReplyDeleteUnix Training in Chennai
Informative blog and it was up to the point describing the information very effectively. Thanks to blog author for wonderful and informative post...
ReplyDeleteJava training in Chennai || J2ee training in Chennai
Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating.
ReplyDeleteoracle training in chennai|| hadoop training in chennai
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
ReplyDeleteRegards,
hadoop training in chennai || selenium training in chennai
Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating. Java training in Chennai
ReplyDeleteYou have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
ReplyDeleteJava Training in Chennai
Java Training in Coimbatore
Java Training in Bangalore
Great Post!!! Thanks for the data update and waiting for your new updates.
ReplyDeleteAndroid Training in Chennai
android classes in chennai
android development course in chennai
Android Course in Chennai
Android Training in Tambaram
Android training in Guindy
Python Training in Chennai
Big data training in chennai
SEO training in chennai
JAVA Training in Chennai
Really a informative blog...Thanks for sharing informative article with us..
ReplyDeleteDrupal Training in Chennai
Drupal 7 Training
Drupal Certification Training
Drupal Training in Anna Nagar
Drupal Training in Tnagar
Photoshop Classes in Chennai
clinical sas training in chennai
SAS Training in Chennai
javascript training in chennai
Hibernate Training in Chennai
It was good explanation and wonderful content. Keep posting...
ReplyDeleteIELTS Coaching in Chennai
IELTS Classes in Chennai
german language course
Japanese Language Course in Chennai
Spoken English in Chennai
TOEFL Training in Chennai
IELTS Coaching in Velachery
IELTS Coaching in Tambaram
I would like to thank the blog admin for sharing this useful information in my vision. I have been searching for this blog for a while.
ReplyDeleteSpoken English Classes in Chennai
Best Spoken English Classes in Chennai
IELTS Coaching in Chennai
IELTS Coaching Centre in Chennai
English Speaking Classes in Mumbai
English Speaking Course in Mumbai
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
IELTS Coaching in Anna Nagar
Spoken English Class in Anna Nagar
Great blog, I was searching this for a while. Do post more like this.
ReplyDeleteAngularJS Training in Chennai
Angular 4 Training in Chennai
Angular 5 Training in Chennai
Angular Training in Chennai
ReactJS Training in Chennai
PHP course in Chennai
Web Designing Training in Chennai
AngularJS Training in Anna Nagar
AngularJS Training in Vadapalani
AngularJS Training in Thiruvanmiyur
Great blog!!! This information is very useful for all. Thanks for sharing with us...
ReplyDeleteAWS Training in Velachery
AWS Training in Anna Nagar
AWS Training in Tambaram
AWS Training in T Nagar
AWS Training in Vadapalani
AWS Training in Porur
AWS Training in Adyar
AWS Training in OMR
AWS Training in Thiruvanmiyur
I really appreciate your method to explaining, I hope to see more posts from your blog. thank you!
ReplyDeleteTableau Training in Chennai
Tableau Course in Chennai
Power BI Training in Chennai
Job Openings in Chennai
Pega Training in Chennai
Linux Training in Chennai
Placement Training in Chennai
Soft Skills Training in Chennai
Appium Training in Chennai
Tableau Training in Velachery
Tableau Training in OMR
The blog you shared is very good. I expect more information from you like this blog. Thankyou.
ReplyDeleteweb designing training in chennai
web designing training in bangalore
web design training coimbatore
Web Designing Course in chennai
web designing course in madurai
Web development training in bangalore
Web development training in chennai
Big Data Course in Coimbatore
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
ReplyDeleteDigital Marketing Institute in Chennai
Digital Marketing Institute in Chennai
Best Digital Marketing Courses in Bangalore
Digital Marketing Training Institute in Coimbatore
Great blog thanks for sharing. Are you looking for digital marketing service?
ReplyDeletedigital marketing company in chennai
seo service in chennai
web designing company in chennai
social media marketing company in chennai
Nice blog thanks for sharing Karuna Nursery is the Best Plant Nursery in Chennai.
ReplyDeleteplant nursery in chennai
rental plants in chennai
corporate gardening service in chennai
Excellent blog thanks for sharing Run your salon business successfully by tying up with the best beauty shop in Chennai - The Pixies Beauty Shop. With tons of prestigious brands to choose from, and amazing offers we’ll have you amazed.
ReplyDeleteGreat Article
ReplyDeleteIEEE Projects on Cloud Computing
Final Year Projects for CSE
JavaScript Training in Chennai
JavaScript Training in Chennai
Awesome blog thankks for sharing 100% virgin Remy Hair Extension in USA, importing from India. Premium and original human hair without joints and bondings. Available in Wigs, Frontal, Wavy, Closure, Bundle, Curly, straight and customized color hairstyles Extensions.
ReplyDeleteVery useful blog thanks for sharing IndPac India the German technology Packaging and sealing machines in India is the leading manufacturer and exporter of Packing Machines in India.
ReplyDeleteI have been reading for the past two days about your blogs and topics, still on fetching! Wondering about your words on each line was massively effective.
ReplyDeletephp online training in chennai
php programming center in chennai
php class in chennnai
php certification course
php developer training institution chennai
php training in chennnai
php mysql course in chennai
php institute in chennnai
php course in chennnai
php training with placement in chennnai
php developer course
Nice post. Thanks for sharing! I want people to know just how good this information is in your article. It’s interesting content and Great work.
ReplyDeleteappium online training
appium training centres in chennai
best appium training institute in chennnai
apppium course
mobile appium in chennnai
mobile training in chennnai
appium training institute in chennnai
Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog.
ReplyDeleteSoftware Testing Training in Chennai
Software Testing Training in Bangalore
Software Testing Course in Coimbatore
Software Testing Training in Madurai
Software Testing Training Institute in Bangalore
Software Testing Course in Bangalore
Testing Course in Bangalore
Ethical hacking course in bangalore
I really appreciate your method to explaining, I hope to see more posts from your blog. thank you!
ReplyDeleteDigital Marketing Course In Kolkata
Web Design Course In Kolkata
SEO Course In Kolkata
Nice blog, it’s so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job. Thank you for this wonderful sharing with us good job
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.
ReplyDeletehardware and networking training in chennai
hardware and networking training in velachery
xamarin training in chennai
xamarin training in velachery
ios training in chennai
ios training in velachery
iot training in chennai
iot training in velachery
Hi,Great information.Thanks for sharing.I always read your blog and get lot of useful information.
ReplyDeletesap training in chennai
sap training in porur
azure training in chennai
azure training in porur
cyber security course in chennai
cyber security course in porur
ethical hacking course in chennai
ethical hacking course in porur
Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
ReplyDeleteJava training in chennai
python training in chennai
web designing and development training in chennai
selenium training in chennai
digital-marketing training in chennai
This article content is really unique and amazing. This article really helpful and explained very well's i am really thankful to you for sharing keep it up..
ReplyDeleteDigital Marketing Service in Kanpur