LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Installing Java2 RE from .bin (https://www.linuxquestions.org/questions/linux-newbie-8/installing-java2-re-from-bin-33091/)

GT I.N.C 10-17-2002 11:35 PM

Installing Java2 RE from .bin
 
I chmod' it ran it and everything....it printed on the screen a bunch of inflating creating etc etc.....now what do i do...i tried a search....but couldn't find it......i need java cause i wish to try this program http://www.tanveer.freeservers.com/p...shDownload.htm

Is there another script to execute after this or something?

Garry :D

GT I.N.C 10-17-2002 11:40 PM

Oh by the way i found a zip file which was created after all the inflating extracting stuff named javaws-1_2_0_01-linux-i586-i.zip i extracted it and it had a script file 'install.sh' i ran that and it asked this and i don't know where to go on: (above was all that licensing agreement stuff)
Code:

Do you agree to the above license terms? [yes or no]
          yes
In order to use Java(tm) Web Start you must have a version of Java 2 standard edition
installed. If you do not, you can download one from http://java.sun.com.
Please enter the path of your installation (eg /usr/local/java/jdk1.2):

i tried various paths and i tried locating java but i couldn't find it.....hope this is enough info...

Garry :D

MasterC 10-18-2002 12:43 AM

Whatis that program?

Anyway, which version do you have? It should have deflated into the directory into which it was. So if:
Java.whatever.bin was in:
/home/files/Java.whatever.bin
and you ran it from there, it should have decompressed there, and now you should move the decompressed folder to /usr/loca/bin/java with:
mv /path/to/decompressed/folder /usr/loca/bin/java

And set your $PATH.

What distro?

Cool

GT I.N.C 10-18-2002 12:47 AM

Is the folder named 'j2re1.4.1_01' i'm running Mandrake 8.2...

Oh and i have heard this $PATH thing alot and i have an idea what it is, but how would i go on setting it?

Garry :D

GT I.N.C 10-18-2002 12:48 AM

Oh and it's some graphic program which i found on tucows i found it interesting and wanted to try it, and it said i needed java, so i thought might aswell install it :)

Garry :D

MasterC 10-18-2002 12:55 AM

Cool...

You might have either a .bash_profile in your ~ directory to edit your $PATH or you might have /etc/profile to edit your path, either one is fine.

As for the folder, yes it probably is, so here is the command to move it (remember you must be root and that you are in the directory that this file exists):
mv j2re1.4.1_01 /usr/local/bin/java

Just like that, you can copy and paste if you'd like. Some people like to move the folder and have the name remain the same, no problems there, you will just have to follow with a symlink to /usr/local/bin/java afterwards, or adjust what you place in your $PATH to show the j2re1.4.1_01 as your java folder.

Oh and 1 more thing, you will actually want to add the bin subdirectory in the j2re1.4.1_01 folder. SO...

Enter the j2re1.4.1_01 folder, make sure you have a /bin directory there, if so, and if you choose to use my moving option then add this to your $PATH:
/usr/loca/bin/java/bin

Cool

GT I.N.C 10-18-2002 01:01 AM

I'm sorry MasterC but i kinda lost you after the move thing ;)
I moved the folder via command to /usr/local/bin/java, now i am lost...
very very sorry hehe....

Garry :D

MasterC 10-18-2002 01:06 AM

he he he, no problem, sometimes I move fast if I think I am boring you with details...

Ok, so you have it moved then, cool.

Now see if you have either (or both) /etc/profile AND/OR ~/.bash_profile

You can just look for them, no need to do a search.

Cool

GT I.N.C 10-18-2002 01:13 AM

Yep got em both...

Garry :D

MasterC 10-18-2002 01:20 AM

Ok so let's go for /etc/profile as it will work for all users that way...

Add the bold to your similar looking line:

Code:

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/local/bin/java/bin"

If that doesn't work, it's the last part:
/usr/local/bin/java/bin

Cool

GT I.N.C 10-18-2002 01:26 AM

This is my profile....i don't know where to put it, sorry....
Code:

# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>

# Users generally won't see annoyng core files
[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1

if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
    PATH="$PATH:/usr/X11R6/bin"
fi

if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
    export PATH=$PATH:/usr/games
fi

umask 022

USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

# some old programs still use it (eg: "man"), and it is also
# required for level1 compliance for LI18NUX2000
NLSPATH=/usr/share/locale/%l/%N

export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH
export HISTCONTROL HISTSIZE

for i in /etc/profile.d/*.sh ; do
        if [ -x $i ]; then
                . $i
        fi
done

unset i


GT I.N.C 10-18-2002 01:26 AM

No wait i know where to put it now :p sorry again....once i put it in...how can i test if java works?

GT I.N.C 10-18-2002 01:29 AM

Ok very very sorry, i know where it goes, but i don't know how to insert it....geeeez i should concentrate more...

MasterC 10-18-2002 01:34 AM

No problem, it's not a biggie ;)

Open up a text editor, and place the following line in your file:
PATH="/usr/local/bin/java/bin"

Just below:
if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
export PATH=$PATH:/usr/games
fi

Just under the fi place the line I have above, just as it is. Then post what you did just to make sure it's all ok.

To paste, just highlight the text here, and click the middle mouse button on the area to paste into.

Cool

GT I.N.C 10-18-2002 01:39 AM

Ok done..here we go....
Code:

# /etc/profile -*- Mode: shell-script -*-
# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com>

# Users generally won't see annoyng core files
[ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1

if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
    PATH="$PATH:/usr/X11R6/bin"
fi

if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then
    export PATH=$PATH:/usr/games
fi
PATH="/usr/local/bin/java/bin"

umask 022

USER=`id -un`
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HISTCONTROL=ignoredups
HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

# some old programs still use it (eg: "man"), and it is also
# required for level1 compliance for LI18NUX2000
NLSPATH=/usr/share/locale/%l/%N

export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH
export HISTCONTROL HISTSIZE

for i in /etc/profile.d/*.sh ; do
        if [ -x $i ]; then
                . $i
        fi
done

unset i


MasterC 10-18-2002 01:45 AM

Looks good, I'd put a space between fi and PATH but that's just for eye pleasure, not anything more.

Anyway, cool. Now, you need to source the file so open up a terminal and type:
source /etc/profile

And that should be it. Now you should have java installed.

Cool

GT I.N.C 10-18-2002 01:48 AM

Hmmm after i was getting happy, this happened....
Code:

[root@localhost etc]# source /etc/profile
bash: id: command not found
bash: dircolors: command not found
bash: locale: command not found
bash: grep: command not found
bash: tty: command not found
bash: TMOUT: readonly variable
bash: id: command not found
[: -ge: unary operator expected
bash: tty: command not found
bash: id: command not found
[: : integer expression expected


MasterC 10-18-2002 01:49 AM

I would simply ignore that for now...

GT I.N.C 10-18-2002 01:52 AM

So everything is cool?, i just run java by typing 'java'? and also in the java directory what is that install script for?

Garry :D

GT I.N.C 10-18-2002 01:54 AM

Oh, i just remembered, that install script was from a .zip file in the java directory, i don't think it matters then....ok thanks alot MasterC!!!....just one more thing...what was thet stuff when i did a source /etc/profile

Garry :D

MasterC 10-18-2002 01:55 AM

Everything should be cool now yes.

What script? Post the conents of your /usr/local/bin/java directory, and also the contents of your /usr/local/bin/java/bin directory.

Cool

MasterC 10-18-2002 01:57 AM

I believe it was setting variables for your terminal. Shouldn't matter as far as all this is going, and actually shouldn't matter overall, as it's just for things that are probably setup somewhere else.

MasterC 10-18-2002 02:00 AM

Whoa, I never saw that src.zip file before, now I am curious. I unzipped elsewhere and am wondering what it's for. Looks like good stuff :confused:

If you find out, let me know, cause that looks important maybe but I haven't had any problems with java on my system :)

Cool

GT I.N.C 10-18-2002 02:07 AM

Geeeez, i love Linux but sometimes it pisses me off just trying to get programs to run...after all that time when i try running the program this prints:
Code:

[root@localhost JPhotoBrush]# java JPhotoBrush.jar
Exception in thread "main" java.lang.NoClassDefFoundError: JPhotoBrush/jar

And here are the contents of those folders...:

Ok i can't show the contents of the folder...because ls or dir couldn't be found....heres proof...unless i'm typing them wrong lol...
Code:

[root@localhost java]# ls
bash: ls: command not found
[root@localhost java]# dir
bash: dir: command not found
[root@localhost java]#


MasterC 10-18-2002 02:11 AM

Ok, so I just decided to unzip it in the java directory, it didn't mess with LimeWire, so I guess it didn't do any harm...

Hmm, I wonder if it's mentioned in the README or INSTALL files?

Anyway, any luck?

Cool

MasterC 10-18-2002 02:17 AM

logout of root and backin

And also source your bash_profile:
source ~/.bash_profile

Ok, so looks like you might need to specify it elsewhere, ok do this:
echo $PATH

If you don't see /usr/local/bin/java/bin

Then our efforts above in /etc/profile didn't work. You will instead need to place that into your bash_profile (and now I am gun-shy, so post the contents of your bash_profile and your bashrc file so I know I am telling you the correct file)

And you will also want to remove the entry we made in /etc/profile for java path.

GT I.N.C 10-18-2002 02:20 AM

Ok ls works, now i just want to know why are we taking out the stuff from profile and now using the bash profile? Java is working i think...it's just that program? is it?

MasterC 10-18-2002 02:26 AM

If java is working now, then that's cool. But no, from that error message it reads as java's problem, not the programs.

Now that ls is working, post the contents.

Cool

MasterC 10-18-2002 02:28 AM

Oh and 1 more thing, to execute that file it's:
java -jar JPhotoBrush.jar

Don't forget the -jar after java

Cool

GT I.N.C 10-18-2002 02:29 AM

Code:

[root@localhost java]# ls
bin/                              LICENSE        readme_ja.html
CHANGES                          man/            readme_ko.html
ControlPanel.html                plugin/        readme_sv.html
COPYRIGHT                        README          readme_zh_CN.html
install.sh*                      readme_de.html  readme_zh_TW.html
javalogo52x88.gif                readme_es.html  sunlogo64x30.gif
javaws/                          readme_fr.html  Welcome.html
javaws-1_2_0_01-linux-i586-i.zip  readme.html
lib/                              readme_it.html

Code:

[root@localhost bin]# ls
arch*          dnsdomainname@  id*        netstat*        stty*
awk@          doexec*        igawk*      nice*          su*
basename*      domainname@    ipcalc*    nisdomainname@  sync*
bash*          echo*          ipv6calc*  open*          tar*
bash2@        egrep@          kill*      ping*          tcsh*
cat*          ex@            linuxconf*  progress*      touch*
chgrp*        false*          ln*        ps*            true*
chmod*        fbresolution*  loadkeys*  pwd*            umount*
chown*        fgrep@          login*      rbash@          uname*
consolechars*  find*          ls*        rm*            usleep*
cp*            gawk*          mail*      rmdir*          vi@
cpio*          gawk-3.1.0*    mkdir*      rpm*            view@
csh@          gettext*        mknod*      rvi@            vim@
cut*          grep*          mktemp*    rview@          vim-minimal*
date*          gtar@          more*      sed*            ypdomainname@
dd*            gunzip*        mount*      sh@            zcat*
df*            gzip*          mv*        sleep*
dmesg*        hostname*      netconf@    sort*

Ok i will do what you said with bash_profile and all that now...

Garry

GT I.N.C 10-18-2002 02:31 AM

geeeez i forgot the -jar .....and umm java doesnt work now.....whys that...since i logged out....i havent touched profile or bash_profile yet...

Garry

MasterC 10-18-2002 02:35 AM

ha ha ha, that's the contents of your /bin directory rather than /usr/local/bin/java/bin

Ok, so, it would appear that the entry in /etc/profile isn't working for whatever reason.

Cool

GT I.N.C 10-18-2002 02:37 AM

Wrong bin folder sorry..
Code:

[root@localhost bin]# ls
ControlPanel*  java_vm*  kinit*  ktab*  policytool*  rmiregistry*  tnameserv*
java*          keytool*  klist*  orbd*  rmid*        servertool*


GT I.N.C 10-18-2002 02:38 AM

So would that mean i have to put it in my bash_profile one?
Yeh i just realised it while reading through the files in it hahaha...:)

Garry

GT I.N.C 10-18-2002 02:39 AM

I'm not sure if this will work i'm still a newbie, but can i make like a link to java in /usr/local/bin/java from /sbin or wherever program commands are installed...would that work?

Garry

MasterC 10-18-2002 02:44 AM

Some people do that, but I just dug up some good info I used to give, here's the page:
http://www.mandrakeuser.org/docs/utils/ujava.html

So follow this part of those instructions:
Quote:

Installing Java

I uninstalled kaffe as it's '/usr/bin/java' appears to conflict with J2SDK/J2RE. Although, I'll note here that the j2sdk*.rpm does not complain about kaffe when installing. Nor does the j2sdk*.rpm modify your .bashrc file! So onward we go:

1. Type su on a terminal and enter your 'root' password.
2. Uninstall kaffe: urpme kaffe
3. Make Java installer package executable: chmod a+x j2sdk-1_4_0-fcs-linux-i386.rpm.bin
4. Execute it: ./j2sdk-1_4_0-fcs-linux-i386.rpm.bin
5. Install it (as 'root'): urpmi j2sdk-1_4_0-fcs-linux-i386.rpm

Create a file called 'java.sh' as 'root' in '/etc/profile.d' containing these lines:

JAVA_HOME=/usr/java/j2sdk1.4.0
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

Make it executable with

chmod +x /etc/profile.d/java.sh

From now on, both variables will be set in all newly opened shells or terminals.
If any of that doesn't make sense to you, I can explain them better.

To further answer your question about symlinking it...

Yes, people do it, and I have done it before, but I suggest trying to get it accomplished this way first rather, and resort to that as a last ditch effort.

BTW, I tried that program, it's kinda cool, but sorta very basic, especially compared to gimp or somthing like it. Java programs usually seem to hog resources and don't move very quickly.

Anyway, let's keep going because it's good to have java installed anyway.

Cool

MasterC 10-18-2002 02:46 AM

And... You will need to modify those /paths/up/there to fit your needs. Basically don't copy and paste cause it won't work.

Cool

GT I.N.C 10-18-2002 02:48 AM

Ok i think you do need to shed some light on this....i don't know where to start and whats this kaffe stuff lol

And yeh i thought that i might aswell install Java too...

Garry

MasterC 10-18-2002 02:55 AM

kaffe is another implementation of java I believe, but I guess a lot of programs don't work with it.

Ok, so I am thinking you probably don't need to worry about the first step (maybe, but I don't know if kaffe conflicts, or even if you have it installed, might be best to uninstall it anyway)

Anyway, so I'll skip down to where you need to do stuff:

We are already here:
Quote:

Create a file called 'java.sh' as 'root' in '/etc/profile.d' containing these lines:

JAVA_HOME=/usr/java/j2sdk1.4.0
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

Make it executable with

chmod +x /etc/profile.d/java.sh
SO, here we go:

Create a file called 'java.sh' as 'root' in '/etc/profile.d' containing these lines:
create the file java.sh in the folder /etc/profile.d using any text editor

Add these lines to that new file
JAVA_HOME=/usr/local/bin/java
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

Save and exit, and now we need to make this file executable so:

chmod +x /etc/profile.d/java.sh


Ok that's what you need to do. I put pointers in there for ya :D

Cool

MasterC 10-18-2002 02:57 AM

NOTE: I have already edited the lines of that file for you, so you can copy and paste from my "pointer" example the lines for java.sh that you are creating.

Cool

GT I.N.C 10-18-2002 02:59 AM

Ok thanks MasterC i will try that STRAIGHT after dinner....if i have any more problems and your not on, it's ok theres no rush :)

Thanks for your help buddy!

Garry :D

MasterC 10-18-2002 03:00 AM

No problem buddy. Have a good dinner, I am going to bed ;)

Cool

GT I.N.C 10-18-2002 03:30 AM

Ok i did all that.....now what do i have to do?? When i type 'java' the command cannot be found....do i add all that stuff in profile again?

Garry :D

GT I.N.C 10-18-2002 03:33 AM

Actually it worked i had to open a new console...now i'm gonna try the program...

Garry :D

Thanks MasterC! i know your in bed hahaha

GT I.N.C 10-18-2002 04:01 AM

Hmmm how could i run this without going to console and typing java -jar bla bla all the time???

Garry :D

Thymox 10-18-2002 08:17 AM

You could create a nice, short little script that passes all the parameters for you. If you're running KDE or Gnome, you could also just create a 'link' to it on your desktop with all the lovely parameters in that.

And how on earth did you get into such trouble installing J2RE? I did something that I don't normally do... I went and got the J2RE-something.rpm.bin. Ran it and it self-expanded to an RPM file. Installed the RPM file and all is well! £0.02

MasterC 10-18-2002 11:20 AM

:) Thymox, look who was helping him :D Anytime you see my name attached to something, it can only lead to problems ;)

Yes, the script would looks something like:

#!/bin/bash
#This is for the JPhotoBrush java program:
cd /to/your/directory/with/JPhotoBrush.jar
java -jar JPhotoBrush.jar
#end script

And copy and paste that into any text editor, edit the path to your program, save the file as JPhotoBrush (or whatever you want) and then:
chmod +x JPhotoBrush
And now you can move that wherever you want, and if you put it in your PATH (maybe in /usr/bin) then you can execute it my just typing JPhotoBrush

I am no bash expert, but I think that's right. Check around first, or ask someone to take a look at it.

Glad you got it working btw, how do you like the program?

Cool

GT I.N.C 10-18-2002 06:15 PM

Thanks alot MasterC....

Yeh the program is ok..i really like the blend effect it's got with it hehehe i don't know how to do that in Gimp..

Garry :D

neo77777 10-18-2002 06:36 PM

For future reference if you need more stuff to do with java -jar just create an alias jjar='java -jar' for instance, you know where to put it right? ~/.bashrc is a good place for aliases, then whenever there is a jar archive to be delt with java -jar just type in console jjar archive.jar and volia!

GT I.N.C 10-24-2002 01:14 AM

ok cool, but yeh another question,when i made that script and put it in profile.d that should make it work for ALL users right? what happens if i want root and other users to run Java? and that program...cause it only runs for 'gt'

Garry :D


All times are GMT -5. The time now is 11:02 PM.