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 trialChris Gauthier
Courses Plus Student 6,434 PointsMessy.java not passing compilation.
Im not sure why this Messy.java file is not passing the check work test. It compiles fine in the local environment.
Any help would be appreciated.
package com.teamtreehouse;
import java.util.*;
public class Messy {
public static void main(String[] args) {
// write your code here
System.out.println("one");
System.out.println("two");
System.out.println("three");
System.out.println("four");
System.out.println("five");
List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
for (String numberWord : numberWords) {
System.out.println(numberWord);
}
}
}
one
two
three
four
five
six
seven
eight
nine
4 Answers
Jef Davis
29,162 PointsWhat's the error you are getting?
Chris Gauthier
Courses Plus Student 6,434 PointsI've got it, thanks for you help, tho!
Chris
Chris Gauthier
Courses Plus Student 6,434 PointsSorry, that was a mistake. Im am stuck on part 5 of that challenge, and the rest of them are passing the parser, fine.
The above code does is incorrect in the online compiler and Im not sure why.
The error Im getting is
JavaTester.java:104: error: cannot access Messy
Messy.main(null);
^
bad source file: ./Messy.java
file does not contain class Messy
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
1 error
Any help would be appreciated.
Jef Davis
29,162 PointsSo, it seems like your Messy.java file isn't in the directory you're telling it to look in. You're doing this in the online compiler from what you copied from IntelliJ, right? I want to say it's because of the package com.treehouse; line. I don't believe that is supposed to be there--it's been a few months since I did this challenge, though. Let me know if that works.
Chris Gauthier
Courses Plus Student 6,434 PointsYep, that was it, thanks!
Jef Davis
29,162 PointsThis link is far more articulate on the matter than I could possibly be: https://www3.ntu.edu.sg/home/ehchua/programming/java/J9c_PackageClasspath.html