Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Professional Java for Web Applications
BOOK: Professional Java for Web Applications
This is the forum to discuss the Wrox book Professional Java for Web Applications by Nicholas S. Williams; ISBN: 978-1-118-65646-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Java for Web Applications section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 7th, 2014, 01:07 PM
Registered User
Join Date: Nov 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default JSPs not compiling with Java 8 in Eclipse Luna

This is my first post, so I hope I'm doing it right.

I'm having the issue where my JSP's compile with the default Eclipse compiler instead of my java 8 compiler.

I've did all the changes from Bug 54461 (link below) without any luck.

Bug 54461 Comment 8 - looks like Nick Williams got it to work somehow.

----------------- Error Message ------------------
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 6 in the jsp file: /WEB-INF/jsp/view/viewSessionActivity.jsp
Underscores can only be used with source level 1.7 or greater
3: <%!
4:     private static String toString(long timeInterval)
5:     {
6:         if(timeInterval < 1_000)
7:             return "less than one second";
8:         if(timeInterval < 60_000)
9:             return (timeInterval / 1_000) + " seconds";
I'm not sure where to change the global Ant compiler properties in the Ant configuration itself (or if it's necessary).

I added the build.compiler property in the Eclipse Ant setup.
Window -> Preferences -> Ant - Runtime - Properties tab.
I tried combinations of:
build.compiler -> modern
build.compiler -> javac1.8

I did this just to try something different, but it didn't change anything:
I added the 3 jar files in the setenv.bat in the Eclipse Ant configuration:
Window -> Preferences -> Ant - Runtime - Global Entries tab.

Running setenv.bat in %tomcat_home%\bin results in:
C:\>cd %tomcat_home%\bin
C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.3\bin>.\setenv.bat
C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.3\bin>echo %classpath%
C:\Program Files\Java\jdk1.8.0_05\lib\tools.jar;C:\Program Files\Java\apache-ant-1.9.2\lib\ant.jar;C:\Program Files\Java\apache-ant-1.9.2\lib\ant-launcher.jar

My tomcat web.xml configurations look like this:
  <!--  I added this from book and bug 54461 -->

Bug 54461 - Comment 6
I tried only changing this parameter from above:
. . . . . 
. . . . .
Any suggestions would be appreciated.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java SE Development Kit and Eclipse IDE for Java EE? Droider BOOK: Beginning Android Application Development 1 October 7th, 2011 08:42 AM
Java Eclipse and Wireshark Interaction Help d-mart Pro Java 0 June 16th, 2009 01:27 PM
Compiling Related java files Jstmehr4u3 J2EE 2 August 9th, 2004 07:18 AM
New to Java, problems compiling Kyle Colyer JSP Basics 3 September 6th, 2003 04:58 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.