Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Professional Java for Web Applications
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 7th, 2014, 01:07 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54461

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

----------------- Error Message ------------------
Code:
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:
Code:
    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
  <!--  I added this from book and bug 54461 -->
        <init-param>
            <param-name>compiler</param-name>
            <param-value>modern</param-value>
        </init-param>
        <init-param>
            <param-name>compilerSourceVM</param-name>
            <param-value>1.8</param-value>
        </init-param>
        <init-param>
            <param-name>compilerTargetVM</param-name>
            <param-value>1.8</param-value>
        </init-param>
        <init-param>
            <param-name>suppressSmap</param-name>
            <param-value>true</param-value>
        </init-param>  
        <load-on-startup>3</load-on-startup>
    </servlet>

Bug 54461 - Comment 6
I tried only changing this parameter from above:
. . . . . 
        <init-param>
            <param-name>compilerTargetVM</param-name>
            <param-value>1.7</param-value>
        </init-param>
. . . . .
Any suggestions would be appreciated.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:57 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.