That is why I though it should be a parameter. 

```java
private static List<String> buildCommandPrefix(String java, Map conf, String childOptsKey) { ...
```

Then you have  

```java
File jvm = new File(new File(System.getProperty("java.home"), "bin"), "java"); 
List<String> toRet = buildCommandPrefix(jvm.toString(), conf, backtype.storm.Config.NIMBUS_CHILDOPTS);
```

and

```java
List<String> toRet = buildCommandPrefix("$JAVA_HOME/bin/java", conf, backtype.storm.Config.NIMBUS_CHILDOPTS)
```