# Problems Installing Java



## gutierrezge (Dec 13, 2008)

Hi guys, im new in FreeBSD i think i installed java, but when i type java on the shell it shows me this messge

/libexec/ld-elf.so.1: Shared object "libpthread.so.2" not found, required by "java"


Any ideas? i think i installed diablo 6, not sure cuz none of what i tried to do was working, so when it worked i didnt saw what package i insalled, but i guess was diablo...

thanks on advande your comments


----------



## sverreh (Dec 13, 2008)

gutierrezge said:
			
		

> Any ideas? i think i installed diablo 6, not sure cuz none of what i tried to do was working, so when it worked i didnt saw what package i insalled, but i guess was diablo...




```
% pkg_info -x diablo
```
will give you information about diablo on your system.


----------



## gutierrezge (Dec 13, 2008)

Yep i have installed diablo
this is the package

diablo-jdk-1.6.0.07.02:

so any ideas why i got this message?

/libexec/ld-elf.so.1: Shared object "libpthread.so.2" not found, required by "java"

what i'm missing?


----------



## paulfrottawa (Dec 13, 2008)

What method did you use to install it?

Just curious


----------



## sverreh (Dec 13, 2008)

gutierrezge said:
			
		

> /libexec/ld-elf.so.1: Shared object "libpthread.so.2" not found, required by "java"



Try to find the file *libpthread.so.2* by one of the following methods:

```
# locate libpthread.so.2
```
This only works if the locate database has been created. If your system is newly installed (less than a week old) you may have to install it. man locate will help. Or, if the locate command doesn't work, you can try find:

```
# find /usr -name \*libpthread.so.2
```
If you find the missing file by any of these methods, you can try to copy or (preferably) softlink it to the same directory were mine is placed:
*/usr/local/lib/compat/libpthread.so.2*

If the file is not found, we will have to do some more digging.


----------



## gutierrezge (Dec 13, 2008)

i run locate libpthread.so.2
and nothing, i updated the database by running locate.updatedb
also i tried the find method and nothing was found.


----------



## gutierrezge (Dec 13, 2008)

paulfrottawa, i downloaded diablo-jdk-freebsd6.i386.1.6.0.07.02.tbz
 from the page (windows pc=, then i transfer it via FTP (cuz is a server without graphics) to /var/ftp then i run 

$pkg_add diablo-jdk-freebsd6.i386.1.6.0.07.02.tbz

then i tried to enter /usr/ports/java/diablo-jdk16 but the folders was not created so i thought that it was already installed, i try to run

$java

and that message appeared.

thanks,


----------



## mfaridi (Dec 13, 2008)

Do you try update your port tree and try again for deinstall and install java ?
I had this problem before but after update port tree and deinstall and install java this problem solved.


----------



## gutierrezge (Dec 13, 2008)

let me try, confirm me this..

$ locate.updatedb
$ make reinstall diablo-jdk-freebsd6.i386.1.6.0.07.02.tbz

is that right?

thanks.


----------



## mfaridi (Dec 13, 2008)

gutierrezge said:
			
		

> let me try, confirm me this..
> 
> $ locate.updatedb
> $ make reinstall diablo-jdk-freebsd6.i386.1.6.0.07.02.tbz
> ...


you must be root for install packages


----------



## gutierrezge (Dec 13, 2008)

du no how to deinstall, how can i create the folders with the .tbz into the ports like the other apps?

thanks,


----------



## gutierrezge (Dec 13, 2008)

im root


----------



## gutierrezge (Dec 13, 2008)

when i run 

make reinstall diablo-jdk-freebsd6.i386.1.6.0.07.02.tbz

into folder /var/ftp it says

make: don't know how to make reinstall. Stop


thanks


----------



## gutierrezge (Dec 13, 2008)

i try to run pkg_delete and this is what it shown

$ pkg_delete diablo-jdk-1.6.0.07.02

pkg_delete: file '/usr/local/diablo-jdk1.6.0/jre/lib/applet' doesn't exist
pkg_delete: unable to completely remove directory '/usr/local/diablo-jdk1.6.0/jre/lib/applet'
pkg_delete: couldn't entirely delete package (perhaps the packing list is
incorrectly specified?)


----------



## gutierrezge (Dec 13, 2008)

this is another wierd stuff

i try to locate the package and this appeared



> $locate diablo-jdk-1.6.0.07.02
> /var/db/pkg/diablo-jdk-1.6.0.07.02
> /var/db/pkg/diablo-jdk-1.6.0.07.02/+COMMENT
> /var/db/pkg/diablo-jdk-1.6.0.07.02/+CONTENTS
> ...



so i decided to enter the diablo folder and this was shown



> [root@gabriel /var/db/pkg]# cd /var/db/pkg/diablo-jdk-1.6.0.07.02
> bash: cd: /var/db/pkg/diablo-jdk-1.6.0.07.02: No such file or directory


----------



## Djn (Dec 13, 2008)

That's not too weird. Locate uses a database that's only regenerated once a week, and you deleted that directory after the last update. It'll catch up sooner or later, or you can run _/usr/src/etc/periodic/weekly/310.locate_ if you want to force it to update now.

As for the pkg_delete warnings, that's nothing to worry about. It's got a list of things to delete, and sometimes that includes things that doesn't exist in your particular case, or things that are for some reason in use at the time. It's not going to cause any problems.


----------



## gutierrezge (Dec 13, 2008)

Ok!! more update....

i finally remove the package installation with the pkg_delete i just need to update the locate database again, now i run 



> pkg_add diablo-jdk-freebsd6.i386.1.6.0.07.02.tbz



then it shown me the licence term and when it finished it said



> pkg_add: warning: package 'diablo-jdk-1.6.0.07.02' requires 'javavmwrapper-2.3.2', but 'javavmwrapper-2.3' is installed



i looked for javavmwrapper-2.3 and it is at /var/db/pkg/

so i think that when i installed java this version was also installed, i need to remove it and install the new one, but where i can find the new javavmwrapper ?

thanks


----------



## gutierrezge (Dec 13, 2008)

i found the javavmwrapper-2.3.2  it at this page

http://www.filewatcher.com/m/javavmwrapper-2.3.2.tbz.30.0.0.html


----------



## ale (Dec 13, 2008)

locate take a "snapshot" of the existing files on your filesystem when it updates it's own db.
locate can't be aware of what files you added/moved/removed unless it db get updated again.
You should be better use _find_.
And it seems that you have a great confusion about ports and packages so you should take a read at this chapter of the handbook.
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html


----------



## gutierrezge (Dec 13, 2008)

thansk ale i will


----------



## gutierrezge (Dec 13, 2008)

Ok guys now i deleted all javavmwrapper and diablo packages and installed first the javavmwrapper, then the diablo, and no warning was shown, so i typed java and it shows the same message 



> $ pkg_delete diablo-jdk-1.6.0.07.02
> $ pkg_delete javavmwrapper-2.3.2
> $ /usr/libexec/locate.updatedb
> $ pkg_add javavmwrapper-2.3.2.tbz
> ...



thanks all


----------



## kamikaze (Dec 15, 2008)

# cd /usr/ports/java/diablo-jdk16
# make clean build
# make deinstall reinstall

That's all you should have to do.

Don't use pkg_add, because it's up to you to chose the right package in that case. Are you truly running FreeBSD 6? Because that's the package you have chosen.


----------



## gutierrezge (Dec 15, 2008)

i dont have this path

cd /usr/ports/java/diablo-jdk16

that port doesnt exist only diablo-jdk15 thats why i downloaded and installed via pkg_add

recentlry i updated the ports via cvus but i havent check if i have diablo-jdk16, but as far as i know i dont have it.

thanks,


----------



## r-c-e (Dec 15, 2008)

What does the output of "uname -a" show?


----------



## ale (Dec 15, 2008)

gutierrezge said:
			
		

> i dont have this path
> 
> cd /usr/ports/java/diablo-jdk16
> 
> ...



http://www.freebsd.org/cgi/cvsweb.cgi/ports/java/diablo-jdk16/
http://www.freebsdfoundation.org/downloads/java.shtml


----------



## halplus (May 9, 2009)

Hi: 

I'm hitting this very same thing. In a server it all went ok. But now when i do this in a virtual machine i use to simulate my server environment i got it. I have some less software installed in this just deployed system. So i think this is a matters of a problem in some of the packages (diablo or its dependencies) that is missing some dependency. I'll try to copy the library from another system and see what happens.


----------



## ale (May 9, 2009)

Can you reply to what r-c-e asked: output of _uname -a_


----------



## halplus (May 10, 2009)

is freebsd 7.0-release #0 with a GENERIC kernel


----------



## ale (May 10, 2009)

halplus said:
			
		

> is freebsd 7.0-release #0 with a GENERIC kernel


And what is the output of `$ ls -la /usr/ports/distfiles/diablo*`?


----------



## halplus (May 11, 2009)

I can't list that directory, it doesn't exists.

is ls: No match.

 However it all makes sense now. Now trying to see the version of the .tgz realized that it is the incorrect version for this OS. Forget it ale false alarm. I was not paying attention to that should say 7 instead of 6. So I guess somebody downloaded the version for freebsd 6 and will have to tell her to download the proper one. Damn I was quite clear. Next time i will publish it in the server so she doesn't have a choice to download something else (I hope I'm not violating some copyright here because i saw some long list of licencing and stuff for java you are not used to see here in BSD zones)

I guess should be the same problem that faced the original poster. Again thanks for the light, that libpthreads never existed in other similar setup jej i even installed the linux emulation layer to see if that could fix it but no luck (of course).

Anyway I want to do a constructive critic for the folks packaging java. I beleive the setup script should detect that is running in another OS and should give a warning instead of go ahead and install everything without a single warning and break with unresolved libraries. Can drive crazy anyone .


----------



## ale (May 11, 2009)

halplus said:
			
		

> Anyway I want to do a constructive critic for the folks packaging java. I beleive the setup script should detect that is running in another OS and should give a warning instead of go ahead and install everything without a single warning and break with unresolved libraries. Can drive crazy anyone .


It seems you are using the package.
The port has a check:
	
	



```
DISTNAME=       ${PKGNAMEPREFIX}caffe-${JDK_OSREL}-${ARCH}-${JDK_VERSION}_${RELEASE_VERSION}-b${BUILD_VERSION}
...
.if ${OSVERSION} >= 700000
JDK_OSREL=      freebsd7
PLIST_SUB+=     RELEASENOTE="@comment "
.else
JDK_OSREL=      freebsd6
PLIST_SUB+=     RELEASENOTE=""
.endif
```
I'm not sure that this kind of logic can be put in a package.


----------



## halplus (May 11, 2009)

Hi ale:

Yes i was installing with a package since is the easier way to do offline things given my small bandwidth (slow dialup, no.. very very slow that i increase a little with SSH tunnel + compression). Anyway about the check i beleive is possible. Packages run pre and post installation scripts as far as i remember. There is even an option in pkg_add to not execute them.

from the pkg_add man page:


```
-I, --no-script
	     If any installation scripts (pre-install or post-install) exist
	     for a given package, do not execute them.
```

so maybe using uname -a with grep or something can permit comparing the os version in one of those pre-install scripts. I would do it but i am not quite advanced in shell script programming (I am not a big fan since i come from strongly typed world). Also when you install diablo first it will print a large license that later you will have to type yes or no for "Do you agree?" And that is an script without doubt.

inside the package i can read in +INSTALL


```
#!/bin/sh
# $FreeBSD$

# Set up a standard path
PATH=/usr/bin:/bin

# Hack to prevent licensing from breaking bento.
if [ "x${PACKAGE_BUILDING}" != "x" ]; then
	exit 0
fi

# Attempt to install a link for the browser plugin during post-install
if [ "$2" = "POST-INSTALL" ]; then
	# Plugin location variables
...
```


----------



## ale (May 11, 2009)

I'm not using packages, so I didn't know it.
Probably there are a lot of macros or ready functions to do this kind of check.
Maybe you should ask for this improvement in the java mailing list.


----------

