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

Problem Importing Files to Src

I have IntelliJ up and running but am having problems importing my files into a blank project.

Edit: Forgot to mention I am running Ubuntu.

When I try to drag and drop my "com" folder into the "src" directory in the IntelliJ window, the com.treehouse.model folder is imported, but I receive a pop-up with an error that says, "Cannot create class-file". The "Song.java" file does get imported, but no other files.

I did some poking around online and found out that this commonly occurs when a folder is not marked as Source, although in this instance the "src" folder is already marked as Source. Further, if I try to unmark it and re-mark it, it creates another com.treehouse.model folder which I suspect is no good and also very sloppy.

If I create a different folder inside the root directory and mark it as source I can import all the files to that folder. I was unsure however if this would affect the running of the code in the future and also still leaves me with problem and just a workaround.

Any thoughts on this would be appreciated, and I will continue to see what I can dig up. Thanks.

1 Answer

The problem seems to lie in the way Ubuntu or IntelliJ handles the drag and drop. The way my system is working now, when I drag and drop it tries to copy the files by default rather than moving them. This was creating the error.

When I used the file explorer and right-clicked on my "com" folder I was able to select "move to" from the dropdown menu and move the "com" folder to the proper directory.