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...
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):
To update java (RHEL):
jvyas> yum install java-1.6.0-sun-devel.x86_64
jvyas> su
Then, as root:
Then, as root:
root> alternatives --config java
There are 2 programs which provide 'java'.
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
+ 2 /usr/lib/jvm/jre-1.6.0-sun/bin/java
Fedora?To install java on Fedora (openjdk)
jvyas> sudo yum list *java* | grep open | grep devel #<-- sanity check to see what JDKs are
available.
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:
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 :)
SETTING UP MAVEN
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)
The up to date waywget -O /etc/yum.repos.d/jpackage50.repo http://www.jpackage.org/jpackage50.repoyum install maven2
wget -O /opt/apache-maven-3-bin.tar.gz http://apache.petsads.us/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz maven-2.2.1-bin.tar.gz
ln -s /opt/apache-maven-3.0.5/bin/mvn /usr/bin/mvnNow 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.
Hmmm actually you can yum install maven on fedora:
ReplyDelete"yum install maven" .
duh .
I don't know how well that worked when you posted it, but when I tried it, I got 3.0.4 which is already out of date: the Maven site recommends only the latest, 3.1.something. Sure enough, their own Android samples will not build w/ 3.0.4.
Delete