AS_JAVA="/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home"
Once you've set this property and then start the GlassFish 4.0 server, it should be running under JDK 8, allowing any of the applications to utilize new Java 8 features, such as streams or lambdas.
Note: This is for experimental use only, as Java EE 7 has not been sanctioned for use with Java 8 at the time of this post.
I have successfully configured GlassFish 4.0 to run under Java 8 in my environment, and tested the use of streams within a Java EE 7 application without issue. Here are some sources demonstrating basic use of streams within a CDI bean:
@Named
@SessionScoped
public class PoolController implements Serializable {
List pools = new ArrayList();
public PoolController(){
pools.add("Pool One");
pools.add("Pool Two");
pools.add("Pool Three");
}
public String getPool(){
System.out.println("The number of pools " + pools.stream().count());
return pools.stream().findFirst().toString();
}
}
No comments:
Post a Comment
Please leave a comment...