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 Spring Basics Modeling, Storing, and Presenting Data Create a POJO

Getting error about package name, but it is not specified that the code should belong to a specific package

Getting error about package name, but it is not specified that the code should belong to a specific package (other than default)

com/teamtreehouse/contactmgr/model/Contact.java

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

The package the class is in has to match the directory path from the top of the source tree. Being in the default package means the file would be in the top source directory of the project (because a default package has no name). If you look at the entire filename for Contact.java you'll you'll see it's down a directory path like you would expect from being in a package. You can figure out the package name from the path shown by replacing the /'s with .'s and put in the appropriate package statement at top.

Add package to top of page

package com.teamtreehouse.contactmgr.model;

//build your POJO