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 trialWolf <null>
5,060 PointsKaraoke.java from WorkSpace to IntelliJ
I'm trying to get the Karaoke program from Java Data Structures course to work in IntelliJ. But I have some trouble with the different imports like:
package com.teamtreehouse;
package com.teamtreehouse.model;
import com.teamtreehouse.KaraokeMachine;
import com.teamtreehouse.model.Song;
import com.teamtreehouse.model.SongBook;
Have put the code as in WorkSpace into IntelliJ.
Karaoke.java | KaraokeMachine.java | Song.java | SongBook.java
But I can't figure out how they should be able to talk to each other, as I don't have it in folders as in WorkSpace.
https://goo.gl/photos/9jxiqwqHmQDTaeUc8 (I'm haven't figured out how to post picture here, the guide on Markdown Cheatsheet don't help much since I can't get it to work)
5 Answers
Steve Hunter
57,712 PointsHere's a Github repository that you can fork and copy into your IntelliJ.
Steve Hunter
57,712 PointsHi Wolf,
You'll need to replicate the folder structure, or change how the packages are named. I'll try a screen-grab ...
Steve.
Wolf <null>
5,060 PointsYes that is what I was trying to figure out, how to rename the packages but not sure how they should be named. I figured that it should be easier that way, but perhaps I have mistaken.
Steve Hunter
57,712 PointsLet me break my app and see if I can get them all in one level like yours! That'll tell us what needs importing and including etc.
What are your imports at the top of Karaoke.java
and are they errors?
Steve Hunter
57,712 PointsThis isn't going to work ... are the project files available for download below the lesson video windows? That'll include the structure. Else we ned to figure out how to pull that from Workspaces. Can you get me a link to the part of the course you are up to, please?
Wolf <null>
5,060 Pointsimport com.teamtreehouse.KaraokeMachine;
import com.teamtreehouse.model.Song;
import com.teamtreehouse.model.SongBook;
public class Karaoke {...
[MOD: Added above code block to demo backticks]
Interface class - KaraokeMachine.java
package com.teamtreehouse; import com.teamtreehouse.model.Song; import com.teamtreehouse.model.SongBook;
public class KaraokeMachine {...
SongBook.java
package com.teamtreehouse.model;
public class SongBook {...
Song.java package com.teamtreehouse.model;
public class Song {...
edit it's hard to format the text in this forum in a decent way.. -_-
Steve Hunter
57,712 PointsEditing is a pain, yes. Use three back ticks then java and it'll format your code.
I'll do one code block in your answer above. Edit your answer to see what I added.
Steve Hunter
57,712 PointsDone. Either way, I could do with the course links to see if there's a quicker solution here. Or I can push my code up to Github and you can pull it down from there, if you want?
Wolf <null>
5,060 PointsNice thank you, manage to get it working on IntelliJ now. But creating a jar file wasn't very easy, never really done it before. And so far I am not getting it to work correctly, not sure what I am missing?
I have the layout of the Karaoke program as in WorkSpace (downloaded the folder).
Steve Hunter
57,712 PointsWhat's requiring a jar file? I'll try this end if you can send me a link to the workspace or course video?
Wolf <null>
5,060 PointsWant to learn how to create a working jar file with the Karaoke program.
The course is here -> https://teamtreehouse.com/library/java-data-structures/efficiency/custom-serialization
Steve Hunter
57,712 PointsOK - the workspace download should have preserved your folder structure; itis odd that it didn't. But then getting full projects in IntelliJ can be a bit of a battle, I find.
I've no experience of making Java Archives, unfortunately; Oracle has some guidance here but I don't know how helpful that would be. The documentation can be a little opaque at times.