PDA

View Full Version : installing jdk



A. Jorge Garcia
06-01-2004, 09:30 PM
OK, I've never had to install java before because KNOPPIX has backdown java and supports javac and java which is all my students need.

My problem is that I'm trying out QUANTIAN and java is not installed. I knoppix-installed QUANTIAN and downloaded the latest javasdk, j2sdk-1_4_2_04-linux-i586.bin, and installed it as root to /usr/local. It created sub directories:

j2sdk1.4.2_04/bin
j2sdk1.4.2_04/demo
j2sdk1.4.2_04/jre
j2sdk1.4.2_04/include
j2sdk1.4.2_04/lib
j2sdk1.4.2_04/man

Now, how do I set the path to include at least /usr/local/j2sdk1.4.2_04/bin (where javac, java, appletviewer and javadoc live) so everyone can use it?

TIA,
AJG

montagne57
06-01-2004, 10:03 PM
Jorge,
I did installed java several times. But never used besides, the need in netscape to enter (and use) certain sites.
I installed from the sun binaries until recently....
Knoppix, quantian are Debian-based distribution, so you've got the powerfull apt-get tool.
Edit
/etc/apt/source.list
and add at the end:
deb ftp://metalab.unc.edu/pub/linux/devel/lang/java/blackdown.org/debian woody main non-free

(one single line)

then run :
apt-get update
apt-get install j2sdk1.3
This will install the j2sdk1.3
(the whole lot of java package are available:
apt-cache search j2sdk
and you'll see all the package available)
sorry if I put too much details in the apt-get description...
hope this help
talueguito
raul

A. Jorge Garcia
06-01-2004, 11:42 PM
Oh, thanx! I couldn't find blackdown with apt-cache search so I went to http://java.sun.com.

In anycase, I'd still like to know how to set the path in case I need it for other apps. I need to install yabasic (IBM BASICA for DOS clone) and phoenix (M$ Visual BASIC clone) - among other things - too!

BTW, now that I've gone to the trouble to install a full jdk, I'd like to use swing and javadoc and appletviewer (not in blackdown). I do use swing in blackdown but I have to download a MAC file swingall.jar in ftp://ftp.baldwinschools.net/calcpage/apcs/JarFiles.zip

TIA,
AJG

user unknown
06-02-2004, 04:28 AM
Welcome Jorge.
This is a Java-Developer speaking.

edit /etc/profile


JAVA_HOME=/usr/local/java
PATH=$PATH:/usr/local/java/bin
export JAVA_HOME
export PATH


I used 'java' instead of 'j2sdk1.4.0-4-beta-alpha.linux-bla' because of 2 reasons:
1) To lazy to tip it in.
2) I recommend to create a symbolic link:


ln -s /usr/local/j2sdk1.4.0-4 /usr/local/java

Then you may install a jdk1.5 parallel, and just change the link, to test the tiger.
But the path and JAVA_HOME (which is important) still point to the right direction.

If you don't like this solution, just specify the complete path in 'profile'.

You needn't restart the system.
To read the profile again, you can source /etc/profile.
But perhaps on user (or root) -level the system-variables have been manipulated after reading profile (~/.profile, /etc/bashrc, ~/.bashrc, ~/.bashlogin)
I guess a re-login will work.

P.S.: I made good experiences using eclipse-gtk for development.
For small files, the midnight-commander and scite are good editors.
I guess scite isn't included in the distro (as well as eclipse).

A. Jorge Garcia
06-02-2004, 06:10 PM
Good, that's what I was looking for, /etc/profile!

My profile is listed below. Can I simply edit the PATH= line and add the path to the jdk?

TIA,
AJG

# /etc/profile
umask 022
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games"
export PATH
# Set LOCALE
if [ -f /etc/sysconfig/i18n ]; then
. /etc/sysconfig/i18n
[ -n "$LANG" ] || LANG="de_DE"
export LANG
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
[ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
[ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
[ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
[ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
[ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
[ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
[ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
[ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
[ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET

if [ -n "$SYSFONTACM" ]; then
case $SYSFONTACM in
iso01*|iso02*|iso15*|koi*|latin2-ucw*)
if [ "$TERM" = "linux" ]; then
if ls -l /proc/$$/fd/0 2>/dev/null | grep -- '-> /dev/tty[0-9]*$' >/dev/null 2>&1; then
echo -n -e '\033(K' > /proc/$$/fd/0
fi
fi
;;
esac
fi
unset SYSFONTACM
fi
# END LOCALE
# enable bash completion in interactive shells
[ "$PS1" -a -f /etc/bash_completion ] && . /etc/bash_completion
PS1="\u@\h:\w\\$ "
alias which="type -path"
alias where="type -all"
alias ll="ls -l --color=auto"
alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"
alias la="ls -la --color=auto"
alias ls="ls --color=auto"

user unknown
06-02-2004, 08:02 PM
Yes.
And don't forget JAVA_HOME!

user unknown
06-02-2004, 08:06 PM
Yes.
And don't forget JAVA_HOME!

A. Jorge Garcia
06-02-2004, 10:49 PM
Why do I need JAVA_HOME? I simply added the path to the PATH= line in etc/profile and all is well.

It strikes me that I should not have downloaded the javasdk*.bin and installed it by making it executable. I think they had a javasdk*.rpm I could have installed via alien. If I had done that I probably wouldn't have to do all this path stuff by hand, right? I've never had to do that with *.deb or *.rpm files....

Another thing, the dox on java.sun.com said to install the *.bin in /usr/local. I don't know why. If I had installed it in /usr/bin, would I have had to worry about the path as /usr/bin was already on my PATH?

TIA,
AJG

user unknown
06-03-2004, 01:25 AM
You normally put only executables in /usr/bin.
If you installed the bin (which is more or less a zip-file, which get's unzipped), your path would have to be set to '/usr/bin/java/bin', because the whole java-directory would have been extracted there.

You could of course move the binaries from /opt/java/bin/* to /usr/bin, but that's not a good idea. Solipcistic binaries do well in /usr/bin, but a big package like java is better managed as a big entity.

You often don't only need to know, where the binaries are, but too where the libs are (*.jar), the docs, etc.

Tools like eclipse, ant, ... only need to know the JAVA_HOME, and can figure out the rest, if the structure $JAVA_HOME/bin, $JAVA_HOME/lib, $JAVA_HOME/docs, ... isn't changed.

If you use JAVA_HOME, you will have nearly zero CLASSPATH - questions.
I don't have any CLASSPATH.
I put all often used jars into /opt/java/jre/lib/ext and everything is found. :)

I don't like rpms, debs etc.
A installation-script for 2 variables to set?
I don't know how deb and rpm handle multi-user installations, and whether they do well, with multiple versions.
For experimenting I need the 1.5-beta, while still using the 1.4.2-release too.
I guess such things aren't easily to be handled by an installation-script.

You run the binary and set up 2 environment-variables (in words: two!
all this path stuff) - in my opinion the dependencies are really reduced to an absolute minimum.

smarchand291
06-12-2004, 05:18 AM
FYI

from knoppix 3.4,kernel 2.4.26 :
Kpackage, then install jre1.1, then all (almost) java applets will
work in mozilla, I think. Correct me if I'm wrong

A+

user unknown
06-13-2004, 12:06 AM
This person has a jdk1.4 - why should he install the super-outdated 1.1?
Other people suggesting to install 1.3... - why not suggesting to install 0.4?

Also he noted 'that everyone can use javac'.
So a JRE will not be a replacement at all.

A. Jorge Garcia
06-13-2004, 07:47 PM
That's corect, user unknown! I'm talking about the JDK not JRE.

Thanx anyway guys,
AJG