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 Data Structures Getting There Packages

Sameer Rao
Sameer Rao
490 Points

javac File not found / Package com doesnt exist

I am wondering how Craig's Programm ran over here, i am getting "file not found error" if i compile Example.java from /home/treehouse/workspace.

However if i change my directory to /home/treehouse/workspace/com , i get the below error "error:package com doesnt exist"

Sameer Rao
Sameer Rao
490 Points

Please find my Example.java and Treet.java files.

Example.java

import com.teamtreehouse.Treet ;

public class Example {

public static void main (String[] args) {

Treet treet = new Treet();
System.out.printf("This is a new Treet : %s \n",treet);

}

}

Treet.java

package com.teamtreehouse;

public class Treet {

}

  1. After performing javac Example.java type the following command "ls"

  2. Do you see a list like this: com Example.class Example.java

  3. Now if you don't see this list the folder structure is wrong.

  4. In the video Craig had us create in our own Workspace the folder named "com", then a sub folder that was named: teamtreehouse and then the file: Treet.java

  5. The "ls" command that I am using is from linux.

  6. You can traverse down/up the folder structure using commands: "cd <folder name>" or up "cd .."

  7. Again for the compile to work correctly the user needs to see the list in step 2. If this help let me know. -fred

1 Answer