# can not install tuxguitar (refueses to use the installed openjdk)



## Kringel (Nov 9, 2012)

I try to install the port audio/tuxguitar. This port depends on java.

*myhost# portmaster /usr/ports/audio/tuxguitar*

```
...

===>>> Port directory: /usr/ports/textproc/dom4j

===>>> Launching 'make checksum' for textproc/dom4j in background
===> No options to configure
===>>> Gathering dependency list for textproc/dom4j from ports
===>>> Initial dependency check complete for textproc/dom4j

===>>> Continuing initial dependency check for devel/itext
===>>> Initial dependency check complete for devel/itext

===>>> Continuing initial dependency check for audio/tuxguitar
===>>> Launching child to install java/diablo-jdk16

===>>> audio/tuxguitar >> java/diablo-jdk16 (14/14)

===>>> Port directory: /usr/ports/java/diablo-jdk16

	===>>> This port is marked DEPRECATED
	===>>> Outdated, consider using openjdk6 or openjdk7


	===>>> If you are sure you can build it, remove the
	       DEPRECATED line in the Makefile and try again.

===>>> Update for java/diablo-jdk16 failed
===>>> Aborting update

Terminated
Terminated
Terminated
Terminated
Terminated
```

I think this means that the default JDK of this port is now deprecated. So i installed one of the recommended alternatives:

*myhost# pkg_info | grep -i jdk*

```
bootstrap-openjdk-r306764 Oracle's Java 6 virtual machine release under the GPL v2
openjdk-7.9.05_1    Java Development Kit 7
```

The handbook sounds like i can select the java port by inserting the following line into */etc/make.conf*:

```
JAVA_PORT='java/openjdk7'
```

But I still get the same error. I took a look at /usr/ports/Mk/bsd.java.mk and found the debug-java target. When i try it inside the directory of the tuxguitar port I get the following:


```
myhost# make java-debug
# User specified parameters:
JAVA_VERSION=                   1.5+	(1.5 1.6 1.7)
JAVA_OS=                        	(native linux)
JAVA_VENDOR=                    freebsd bsdjava sun	(freebsd bsdjava sun)
JAVA_BUILD=                     jdk
JAVA_RUN=                       jre
JAVA_EXTRACT=                   

# JDK port dependency selection process:
_JAVA_PORTS_POSSIBLE=           JAVA_PORT_NATIVE_FREEBSD_JDK_1_6 JAVA_PORT_NATIVE_FREEBSD_JDK_1_5 JAVA_PORT_NATIVE_BSDJAVA_JDK_1_6 JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5 JAVA_PORT_LINUX_SUN_JDK_1_7 JAVA_PORT_LINUX_SUN_JDK_1_6 JAVA_PORT_LINUX_SUN_JDK_1_5
_JAVA_PORTS_INSTALLED=          JAVA_PORT_NATIVE_OPENJDK_JDK_1_7
_JAVA_PORTS_INSTALLED_POSSIBLE= 
_JAVA_PORT=                     JAVA_PORT_NATIVE_FREEBSD_JDK_1_6
_JAVA_PORT_INFO=                PORT=java/diablo-jdk16 HOME=/usr/local/diablo-jdk1.6.0 VERSION=1.6.0 OS=native VENDOR=freebsd

# Selected JDK port:
JAVA_PORT=                      java/diablo-jdk16
JAVA_HOME=                      /usr/local/diablo-jdk1.6.0
JAVA_PORT_VERSION=              1.6.0
JAVA_PORT_OS=                   native	(Native)
JAVA_PORT_VENDOR=               freebsd	(FreeBSD Foundation)

# Additional variables:
JAVAC=                          /usr/local/diablo-jdk1.6.0/bin/javac
JAVA_CLASSES=                   /usr/local/diablo-jdk1.6.0/jre/lib/rt.jar
sternmull# JAVA_PORT=java/openjdk7 make java-debug
JAVA_PORT=java/openjdk7: Command not found.
sternmull# bash JAVA_PORT=java/openjdk7 make java-debug
bash: JAVA_PORT=java/openjdk7: No such file or directory
sternmull# JAVA_PORT=java/openjdk7 make java-debug
sternmull# make java-debug
# User specified parameters:
JAVA_VERSION=                   1.5+	(1.5 1.6 1.7)
JAVA_OS=                        	(native linux)
JAVA_VENDOR=                    freebsd bsdjava sun	(freebsd bsdjava sun)
JAVA_BUILD=                     jdk
JAVA_RUN=                       jre
JAVA_EXTRACT=                   

# JDK port dependency selection process:
_JAVA_PORTS_POSSIBLE=           JAVA_PORT_NATIVE_FREEBSD_JDK_1_6 JAVA_PORT_NATIVE_FREEBSD_JDK_1_5 JAVA_PORT_NATIVE_BSDJAVA_JDK_1_6 JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5 JAVA_PORT_LINUX_SUN_JDK_1_7 JAVA_PORT_LINUX_SUN_JDK_1_6 JAVA_PORT_LINUX_SUN_JDK_1_5
_JAVA_PORTS_INSTALLED=          JAVA_PORT_NATIVE_OPENJDK_JDK_1_7
_JAVA_PORTS_INSTALLED_POSSIBLE= 
_JAVA_PORT=                     JAVA_PORT_NATIVE_FREEBSD_JDK_1_6
_JAVA_PORT_INFO=                PORT=java/diablo-jdk16 HOME=/usr/local/diablo-jdk1.6.0 VERSION=1.6.0 OS=native VENDOR=freebsd

# Selected JDK port:
JAVA_PORT=                      java/diablo-jdk16
JAVA_HOME=                      /usr/local/diablo-jdk1.6.0
JAVA_PORT_VERSION=              1.6.0
JAVA_PORT_OS=                   native	(Native)
JAVA_PORT_VENDOR=               freebsd	(FreeBSD Foundation)

# Additional variables:
JAVAC=                          /usr/local/diablo-jdk1.6.0/bin/javac
JAVA_CLASSES=                   /usr/local/diablo-jdk1.6.0/jre/lib/rt.jar
```

Obviously my attept to select the openjdk7 port failed. What did I wrong? How do I fix it?

Maybe my understanding of this configuration process is wrong. I can read simple makefiles but bsd.java.mk contains too much voodoo.


----------



## Kringel (Nov 10, 2012)

After reading this thread and this blog post i tried with the following lines in /etc/make.conf:

```
JAVA_VENDOR=openjdk
JAVA_VERSION=1.7
BOOTSTRAPJDKDIR=/usr/local/openjdk7
JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_OPENJDK_JDK_1_7
```

Still the same problem. I wonder what is goning wrong here.


----------



## graudeejs (Nov 10, 2012)

`#  pkg_add -r openjdk7`
This will install openjdk7

If you want to build from ports, you still need to have JDK installed. Otherwise it can't bootstrap.
So this means that first you pkg_add, then reinstall from ports.


----------



## Kringel (Nov 10, 2012)

I dont think thats the problem. It seems openjdk7 installed successfully:

```
$ pkg_info | grep -i jdk
bootstrap-openjdk-r306764 Oracle's Java 6 virtual machine release under the GPL v2
openjdk-7.9.05_1    Java Development Kit 7
openjdk6-b27        Oracle's Java 6 virtual machine release under the GPL v2
$ javac -version
javac 1.7.0_09
$ ls -l /usr/local/ | grep -i jdk
drwxr-xr-x    6 root  wheel    512 Nov  9 21:57 bootstrap-openjdk
drwxr-xr-x    9 root  wheel    512 Nov 10 09:30 openjdk6
drwxr-xr-x    9 root  wheel    512 Nov  9 22:10 openjdk7
```
I think the problem is the bsd.java.mk (may be caused by my settings). The strange thing is that "make java-debug" detects java/diablo-jdk16 which is not installed on my system (see my first post for the output of this command). But with the documentation I found (barely something for endusers, just some stuff for port developers) it is hard to tell if this a bug in the makefiles or if I am doing wrong. All I know is coming from forum threads, blogs and from reading bsd.java.mk


----------



## graudeejs (Nov 10, 2012)

I think if you remove openjdk6 and bootstrap-openjdk-r306764 (I'm not sure what the hell is this) it will work.

Backup and try.

P.S.
you can easily backup packages with ports-mgmt/bpkg


----------



## Kringel (Nov 11, 2012)

Good idea. I removed those two packages and openjdk7 is the only one left. But the makefile still chooses the diablo thingy.

After I spent so much time trying to understand what is going on and how to do it the right way I came to the impression that this java stuff is not well supported.

the documentation is nebulous
no one in this forum seems to know how set up java ports
I think bsd.java.mk is broken (it detects an a jdk that is not installed...)


----------



## graudeejs (Nov 11, 2012)

Kringel said:
			
		

> Good idea. I removed those two packages and openjdk7 is the only one left. But the makefile still chooses the diablo thingy.
> 
> After I spent so much time trying to understand what is going on and how to do it the right way I came to the impression that this java stuff is not well supported.
> 
> ...



Personally I don't use Java and probably many other users try to avoid it.
You probably messed you config somewhere, we just can't find where, cause when I used java it worked like charm.
You can contact developers on mailinglist. Here mostly are simple users 


While writing this, I check ports Makefile.
It looks (but i'm not 100% confident) that it doesn't mention openjdk as supported java vendors.
And since freebsd vendor is first on the list, it will use diablo-jdk.
I think you should contact port maintainer about this.


----------



## Kringel (Nov 11, 2012)

graudeejs said:
			
		

> It looks (but i'm not 100% confident) that it doesn't mention openjdk as supported java vendors.



You are a *beep*ing HERO  You (and a few minor other tricks) helped me to finally install tuxguitar! And the best: It works! What a happy end for this weekend.

Here are the steps that finally allowed me to install tuxguitar:

 add openjdk to the java vendors in /usr/ports/audio/tuxguitar/Makefile
    JAVA_VENDOR=	openjdk freebsd bsdjava sun
 install java/openjdk6 (bouncycastle can not build with openjdk7, failes because "jdk17.xml" is missing)
 the dependency libxul19 has known vulnerabilities. To ignore them you can do the following:
      cd /usr/ports/www/libxul19
      make -DDISABLE_VULNERABILITIES
      make install clean
 set openjdk6 as your prefered JDK in /etc/make.conf (i dont know if this is really neccessary)
    JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_OPENJDK_JDK_1_6
 finally "portmaster audio/tuxguitar" finished sucessfully!

Now I am happy it worked. But I am also a bit sad that it was this hard and that I had to alter the port to make it work. If this does not get fixed in the future I will have to find this post again to repeat the procedure. I should file a bug... but that would be the third one today :\


----------

