The Gluster Blog

Gluster blog stories provide high-level spotlights on our users all over the world

Setting up a Java+Maven on RHEL/Fedora

Java Development on RHEL
(This post is very very boring)

First you need the JDK !
I never understood the config –alternatives command in linux… I guess its really simple. It just configures what symlinks should point to when more than one program is capable of performing a certain function on your machine. 

But, since I just got my RedHat laptop, I had to hack it up to use JDK 64.  Rather than 32 bit java, and I was afraid to “uninstall” 32 bit java, because uninstalling the stock, standard, issued Java seems to have strange consequences sometimes…

So I went about it the “configure –alternatives” route: 

To update java (RHEL): 

jvyas> yum install java-1.6.0-sun-devel.x86_64
jvyas> su
Then, as root: 
root> alternatives –config java

There are 2 programs which provide ‘java’.

Selection    Command
*  1           /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
+ 2           /usr/lib/jvm/jre-1.6.0-sun/bin/java


             To install java on Fedora  (openjdk)
             jvyas> sudo yum list *java* | grep open | grep devel #<– sanity check to see what JDKs are
             Hopefully, you should see something like “java-1.6.0-openjdk-devel.x86_64”.
             jvyas> sudo yum install java-1.6.0-openjdk-devel.x86_64

And next, you simply hit (1) to tell your machine to use java.

And then if you run it a second time, you can see that you are now using the up to date java, with the other one still intact:
root> alternatives –config java

There are 2 programs which provide ‘java’.

  Selection    Command
*+ 1           /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-sun/bin/java

And then theres finally the grand finale:

[root@jvyas usr]# java -version
java version “1.6.0_37”
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)

Yay for 64 bit JDK 🙂


Now you (probably) need Maven .. (no, you cant just say “yum install mvn”)? So.. here’s how you do it.

#The OLD maven (not sure how often this is updated)
wget -O /etc/yum.repos.d/jpackage50.repo

yum install maven2

The up to date way

wget -O /opt/apache-maven-3-bin.tar.gz maven-2.2.1-bin.tar.gz 

ln -s /opt/apache-maven-3.0.5/bin/mvn /usr/bin/mvn

Now you should be able to run “mvn –version” from anywhere after you open a new terminal, to confirm that your mvn was installed properly.

Yippee … mvn3 + java 6+ = dev productivity.


  • 06 Dec 2020
    Looking back at 2020 – with g...

    2020 has not been a year we would have been able to predict. With a worldwide pandemic and lives thrown out of gear, as we head into 2021, we are thankful that our community and project continued to receive new developers, users and make small gains. For that and a...

    Read more
  • 27 Apr 2020
    Update from the team

    It has been a while since we provided an update to the Gluster community. Across the world various nations, states and localities have put together sets of guidelines around shelter-in-place and quarantine. We request our community members to stay safe, to care for their loved ones, to continue to be...

    Read more
  • 03 Feb 2020
    Building a longer term focus for Gl...

    The initial rounds of conversation around the planning of content for release 8 has helped the project identify one key thing – the need to stagger out features and enhancements over multiple releases. Thus, while release 8 is unlikely to be feature heavy as previous releases, it will be the...

    Read more