Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Intro to Java Web Development with Spark Diving into Web Development Sending Responses

Martin Gallauner
Martin Gallauner
10,808 Points

No Autoimport for HandlebarsTemplateEngine

Hi there

I followed Craig's instructions but somehow Intellij don't want to Autoimport the HandlebarTemplateEnginge class and I have no idea what I'm missing. The handlebar/mustache Plugin is installed.

This is how my dependencies look like:

dependencies { compile "com.sparkjava:spark-core:2.6.0" compile 'com.sparkjava:spark-template-handlebars:2.5.5' compile 'org.slf4j:slf4j-simple:1.7.21' testCompile group: 'junit', name: 'junit', version: '4.12' }

I made a Screenshot, I hope that helps.

Thanks

2 Answers

Make sure you have already created it :). Assuming it is there make sure the class is not private or, if it is not in the same package, make sure it is not package-private (where it is usually public, there is nothing there). Another issue could be the class's initializer. Make sure that is accessible from where you're trying to access it.

Martin Gallauner
Martin Gallauner
10,808 Points

Thanks for you fast reply Trent! I didn't created it since it should be a dependency from the spark framework. But I'm not sure about this

Sławomir Lasik
Sławomir Lasik
7,792 Points

Try to add

import spark.ModelAndView;
import spark.template.handlebars.HandlebarsTemplateEngine;

above

import static spark.Spark.get;

If it works it is something with intellij. That tool is still a bit mystery for me.