Development setup under Ubuntu

W

Wes Gray

Forgive a possible newbie question. I'm running Kubuntu (Feisty) and
would like to learn java using Eclipse. I added the Eclipse package
and the GNU gcj package, thinking the GNU solution was the way to go.
After playing around with it I've discovered that I'm limitted to
1.4 java functionality. I then tried adding sun-java6-jdk and
sun-java6-jre, but when I create a new package in eclipse the only
jre option I see is the java-1.4.2-gcj one, and it can't find any
others. What packages do I need to load to get the latest java
working under Eclipse?

Thanks!
 
P

Pseudo Silk Kimono

Forgive a possible newbie question. I'm running Kubuntu (Feisty) and
would like to learn java using Eclipse. I added the Eclipse package
and the GNU gcj package, thinking the GNU solution was the way to go.
After playing around with it I've discovered that I'm limitted to
1.4 java functionality. I then tried adding sun-java6-jdk and
sun-java6-jre, but when I create a new package in eclipse the only
jre option I see is the java-1.4.2-gcj one, and it can't find any
others. What packages do I need to load to get the latest java
working under Eclipse?

Thanks!

Greetings,

I have the exact same setup as you, except that I prefer Ubuntu rather
than Kubuntu.

Here is what I did. YMMV

I downloaded the Sun JDK 6 from the sun site

http://java.sun.com/javase/downloads/index.jsp (I picked JDK 6 Update 2)

and installed it in /usr/local

Then, I set my JAVA_HOME to be /usr/local/jdk1.6.0_01 (or what ever it
calls itself)

This is done in my .bashrc

Once the JAVA_HOME is set, I export it.
Then, I add a line to my .bashrc to set the PATH.
Here are the important pieces of my .bashrc

export JAVA_HOME=/usr/local/jdk1.6.0_02
export ANT_HOME=/usr/local/apache-ant-1.7.0
export TOMCAT_HOME=/usr/local/apache-tomcat-5.5.23
export ECLIPSE_HOME=/usr/local/eclipse
export PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:${TOMCAT_HOME}/bin:${ECLIPSE_HOME}:${PATH}
alias runArgo="cd /usr/local/argo; java -jar ./argouml.jar &"
alias runEclipse="cd ${ECLIPSE_HOME}; ./eclipse &"

As you can see, I tend to install everything in /usr/local This lets me
use SimpleBackup to back up the contents of the directory with the
assurance that I will get everything.

The important pieces, in my opinion, are JAVA_HOME, ANT_HOME,
TOMCAT_HOME and ECLIPSE_HOME and the corresponding pieces of the PATH
line.
The alias for runEclipse lets me run eclipse from the command line in
the background so that I can do other things at the same time.

Once you've set up your environment and appropriate PATH variables, you
can start up Eclipse, and navigate to the Install Runtimes of your
Windows -> Preferences. From there, it should be easy to navigate to
where you installed the Sun JDK, assuming you followed these
instructions, or made similar changes.

Please note: If you are going to install to /usr/local, you will need
to either
a) use sudo during the installation or
b) use sudo to set the permissions correctly on /usr/local

Otherwise you will not be able to write to the directory.

Hope this helps

BTW... ArgoUML is a nice opensource UML program which you can download
from

http://argouml-downloads.tigris.org/



--
Track 9 of _Clutching At Straws_
A hand held over a candle in angst fuelled bravado
a carbon trail scores a moist fresh palm
Trapped in the indecion of another fine menu
and you sit there and ask me to tell you the story so far
http://www.songlyrics.com/song-lyrics/Marillion/Clutching_At_Straws/Slainte_Mhath/93706.html
 
M

Martin Gregorie

Pseudo said:
>
This is done in my .bashrc

Once the JAVA_HOME is set, I export it.
Then, I add a line to my .bashrc to set the PATH.
Here are the important pieces of my .bashrc

export JAVA_HOME=/usr/local/jdk1.6.0_02
export ANT_HOME=/usr/local/apache-ant-1.7.0
export TOMCAT_HOME=/usr/local/apache-tomcat-5.5.23
export ECLIPSE_HOME=/usr/local/eclipse
export PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:${TOMCAT_HOME}/bin:${ECLIPSE_HOME}:${PATH}
alias runArgo="cd /usr/local/argo; java -jar ./argouml.jar &"
alias runEclipse="cd ${ECLIPSE_HOME}; ./eclipse &"
Assuming that the bash structures in Ubuntu are the same as for Fedora,
a better place to put Java-related stuff is in a "java.sh" file in
/etc/profile.d - /etc/profile will automatically find and run it.

Secondly, remember to make a copy of the file somewhere in a user
directory - otherwise it will be nuked next time you do a clean install
because that wipes and recreates the /etc filing structure.

I do the following to make reinstalls more painless:
- /home is a separate partition so it will survive a reinstall
without damage. All other partitions can be reformatted
without losing anything vital.
- I moved the entire /usr/local hierarchy to /home/local and
replaced /usr/local with a symlink to /home/local.
This means I recover local stuff after a reinstall by removing
the new local structure (which is empty) and recreating the
symlink.
- I've done the same with the Java installation (/usr/java is a
symlink to /home/java.
- all files I've manually changed in /etc and /var are copied to
an equivalent structure in mt development user so they'll survive
a reinstall.
- the /etc and /var backups are under cvs version control for
added safety. The CVS repository is in /home/cvs
As you can see, I tend to install everything in /usr/local This lets me
use SimpleBackup to back up the contents of the directory with the
assurance that I will get everything.
I do essentially the same, but I back up /home to a portable USB drive
with rsync. This keeps a copy of my entire filing system in sync with
the original.

rsync is fast: doing same backup with tar to produce a compressed
archive on a USB disk takes 50 mins. rsync does effectively the same job
in under 15.
 
P

Pseudo Silk Kimono

Assuming that the bash structures in Ubuntu are the same as for Fedora,
a better place to put Java-related stuff is in a "java.sh" file in
/etc/profile.d - /etc/profile will automatically find and run it.

I can see the benefit to this but I would suspect that it would only
really benefit a multi-user system?
Secondly, remember to make a copy of the file somewhere in a user
directory - otherwise it will be nuked next time you do a clean install
because that wipes and recreates the /etc filing structure.

SimpleBackup backs up /home/.... /var/www and /usr/local to an external
USB drive. I don't know how to use rsync, although I have seen several
mentions of it in the ubuntu news group (alt.os.linux.ubuntu)

Based on what you say, there are several improvements I could make to my
system, but it works fine as it is. However, I just installed CentOS on
my second HD so I might try some of your ideas with that since my FF
installation is my production distro and I'd rather not run the risk of
messing it up.




--
Track 9 of _Clutching At Straws_
A hand held over a candle in angst fuelled bravado
a carbon trail scores a moist fresh palm
Trapped in the indecion of another fine menu
and you sit there and ask me to tell you the story so far
http://www.songlyrics.com/song-lyrics/Marillion/Clutching_At_Straws/Slainte_Mhath/93706.html
 
M

Martin Gregorie

Pseudo said:
I can see the benefit to this but I would suspect that it would only
really benefit a multi-user system?
No, its good for any system, desktop, server or whatever.

The benefit is that by doing this you don't modify /etc/profile or
/etc/bashrc, so after a reinstall that's one less file to remember to
edit your favorite customizations into. Take a look at /etc/profile.
Right at the end you can see the loop that finds and executes all files
in /etc/profile.d

Changes made to /etc/bashrc and /etc/profile are global: per-user
customizations should be put in .bashrc and .bash_profile (and possibly
..bash_logout) in the $HOME directory of the user they affect.
SimpleBackup backs up /home/.... /var/www and /usr/local to an external
USB drive. I don't know how to use rsync, although I have seen several
mentions of it in the ubuntu news group (alt.os.linux.ubuntu)
Sounds like a decent solution in that case.

I didn't find that. I was using Amanda until my tape deck died. A quick
comparison of the price of DDS4 drives and USB external disks convinced
me that there had to be a better backup medium than tape. :)

"man rsync" tells all. You might have to experiment with it a bit to get
it working exactly how you want because its options are many and various.

BTW, if you're thinking of making compressed backups, both tar and zip
are good. The problem is media related. Most USB drives are preformatted
as a single FAT-32 partition. This works out of the box BUT a FAT-32
limit is that no individual file may exceed 4GB and a complete system
backup may well break that limit, leaving you with a corrupt and useless
backup. The solution is simple: just reformat the USB drive as an ext2
or ext3 partition. Ext2 & ext3 can both store files as large as the free
space on the disk.
Based on what you say, there are several improvements I could make to my
system, but it works fine as it is. However, I just installed CentOS on
my second HD so I might try some of your ideas with that since my FF
installation is my production distro and I'd rather not run the risk of
messing it up.
Sure, I can see why you'd not want to fiddle with the production system.

However, once you've recovered from a dead disk or done a fresh install
from a new distro version you'll see the benefit of keeping /home in a
separate partition. The symlink tricks just increase the benefit.

Making copies of customized files outside /etc is IMO essential. Its
well worth spending time going through /etc looking for files with dates
after the date&time when you did the install. Take a look at the find
utility - its designed for this type of search. Doing the same for /var
is only necessary if you're running named (the DNS domain files are in
/var/named) or Apache (the root Web pages are in /var/www).

The other common partitioning trick is to put /var (and maybe /tmp) in
their own partitions. Both can grow unpredictably and putting them in
separate partitions limits that growth and prevents, say runaway writes
to /tmp, from having too much impact on the system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top