# Need help for user-defined JAVA version.



## Chian (Feb 24, 2014)

Need help for user-defined JAVA version.

The default java port is java/openjdk6 current. In some reasons, I want to switch to java/openjdk7. So I add JAVA_VERSION=1.7 to /etc/make.conf as usual, but it doesn't work. After some test, I found that if the port's Makefile include JAVA_VERSION and specified blow 1.7 such as 1.5+, 1.6+, the ports always use java/openjdk6. Although I can install java/openjdk7 manually, I wish to use ports-mgmt/poudriere to build the ports automatic.

Anyone can give me some tips? Thanks


----------



## SirDice (Feb 24, 2014)

I think you need to use this in /etc/make.conf:

```
JAVA_PREFERRED_PORTS= JAVA_PORT_NATIVE_OPENJDK_JDK_1_7
```

Not sure if that's correct, it's been a while since I wanted to change the default. Although this sets the default version it's possible some ports will still insist on a different version.


----------



## Chian (Feb 24, 2014)

```
JAVA_VERSION?=1.7
```
not work too.


----------

