April 22, 2014

How to use Java 8 with WildFly 8 and Eclipse

Prerequisites:

1. Download and install Java 8
2. Download and install WildFly 8
4. Download and install Eclipse Luna (4.4) (or Kepler 4.3 patched for Java 8)

Configure WildFlys VM args

Before starting WildFly, update your standalone.conf, or domain.conf by replacing the following JVM argument:
-XX:MaxPermSize=256m
with:
-XX:MaxMetaspaceSize=256m

The removal of the MaxPermSize property will prevent VM warnings from showing in WildFlys startup logs.

The -XX:PermSize and -XX:MaxPermSize VM arguments are now redundant as PermGen has been replaced in Java 8 with Metaspace. The new VM arguments are -XX:MetaspaceSize and -XX:MaxMetaspaceSize.
Note that the Metaspace data will sit in your computers native memory. For a rundown on the differences between PermGen and Metaspace, check out this blog.

Installing JBoss Tools

In Eclipse Luna (4.4), go to Help > Eclipse Marketplace and type 'JBoss Tools', and click go.  Make sure that you select and install the version that matches your Eclipse install. In this example it is JBoss Tools (Luna) 4.2.0.Beta1.



Click install.

On the next screen you can select which components of JBoss Tools you want to install. To install just the server adapter, select 'JBossAS Tools'. Agree to the terms and click OK. Restart Eclipse when you are given the option to do so.

Now choose File > New > Server. Expand the 'JBoss Community' node and select the option 'WildFly 8'.



Click Next, and Next again

Make sure you select your installed Java 8 JRE, and that you point the home directory to that of your WildFly root directory (As shown below). Click finish.



Finally, in your servers view (Window > Show View > Servers), Select the WildFly Server, right click and select start. All being well, WildFly should now start up.


Finally to configure your WildFly server settings, double click on the WildFly server in your servers view. The screen above should be displayed, allowing you to configure your server/deployment properties.

No comments :

Post a Comment