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 Java Objects (Retired) Delivering the MVP Wrapping up

Alexander Nowak
Alexander Nowak
498 Points

Is it possible to copy my code that i have written in workspaces into a IDE?

Hi, I am looking to copy the code i have written in workspaces into a IDE, i have downloaded intellij idea 14?

wondered if anyone could help me with this?

Thanks

Alex

ForumPost.java
public class ForumPost {
  private User mAuthor;
  private String mTitle;
  private String mDescription;

  public User getAuthor() {
    return mAuthor;
  }

  public String getTitle() {
    return mTitle;
  }

  // TODO: We need to expose the description
}
User.java
public class User {

  public User(String firstName, String lastName) {
    // TODO:  Set the private fields here
  }
}
Forum.java
public class Forum {
  private String mTopic;

  public String getTopic() {
      return mTopic;
  }

  public void addPost(ForumPost post) {
      /* When all is ready uncomment this...
      System.out.printf("New post from %s %s about %s.\n",
                         post.getAuthor().getFirstName(),
                         post.getAuthor().getLastName(),
                         post.getTitle());
      */
  }
}
Example.java
public class Example {

  public static void main(String[] args) {
    System.out.println("Starting forum example...");
    if (args.length < 2) {
       System.out.println("first and last name are required. eg:  java Example Craig Dennis");
    }
    // Forum forum = new Forum("Java");
    // Take the first two elements passed args
    // User author = new User();
    // Add the author, title and description
    // ForumPost post = new ForumPost();
    // forum.addPost(post);
  }
}
Rachelle Wood
Rachelle Wood
15,362 Points

What OS are you on? Which IDE? In the past I just copied and pasted the files into NetBeans IDE on a Windows machine. No need to download anything.

3 Answers

On workspaces, go to > File > Download Workspace, and it will download a zip file with the entire project directory structure inside. From there, just follow the instructions for your IDE for importing any project folder into your environment.

Alexander Nowak
Alexander Nowak
498 Points

I have downloaded my project and have tried to import it into my IDE Intellij IDEA but i doesn't seem to work. What IDE would you recommend? Thanks for your help

Rachelle Wood
Rachelle Wood
15,362 Points

I could not get this to work using NetBeans IDE on Windows. I kept getting an error message when I tried to import the files. It sounds like you might be having the same issue. The only way I could get it to work was by copying and pasting the workspaces code directly into newly created files in the IDE. Yeah, it is not terribly elegant, but it works!

Alexander Nowak
Alexander Nowak
498 Points

Hi, I'm on a mac, my current software is OS X 10.9.5. Im happy to download the netbeans if thats better? I just want to be able to copy and paste my workspaces code to the IDE and be able to run it in there.

Thank you so much for your help,

Alex

Rachelle Wood
Rachelle Wood
15,362 Points

I am not sure how much help I can be to trouble shoot for a Mac honestly since I was originally on Windows 7. I did just switch to using Linux this week but I haven't set up an IDE yet on the new OS. Linux is a lot more like Mac OS, but I am still learning it. I am using Vim text editor at the moment since I am following the Rails courses on Treehouse. Honestly though, I think the copy/paste method is your best chance. As I mentioned below, I could not import the workspaces projects into my IDE either. Alternatively, you could completely switch to using your IDE instead of workspaces since you won't really need the latter as long as the language you want to program in is supported by your IDE. Good luck!

Alexander Nowak
Alexander Nowak
498 Points

Thanks for your help Rachelle!

Rachelle Wood
Rachelle Wood
15,362 Points

You're welcome. Not sure how much I helped but at least it is the "fail safe" method :)