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 trialTodd Baker
17,207 PointsHow To Run Gradle Task
The video on how to run a Gradle task isn't running. Is there a way to make the quick video on how to run this Gradle task available? I'm having trouble figuring out how to run the java program downloaded for this exercise.
Oshedhe Munasinghe
8,108 PointsI guess because you have opened the file from Downloads file instead IdeaProject.
You have to unzip the file and paste it in: User -> toddbaker -> IdeaProjects User Then start the IntelliJ program and choose Import Project then choose the catalog printer ( btw they have a double map I dunno why)
After that, you get the error of red text and suggesting to update - click on that go to file gradlew and check to accept their suggestion also, file gradlew bat
then go to main.class and click the green "play" button to run...
Todd Baker
17,207 PointsThanks Oshedhe! That helped a lot and I was able to run it.
Oshedhe Munasinghe
8,108 Points🎉
4 Answers
Peter Ayad
Front End Web Development Techdegree Graduate 20,766 PointsHey Oshedhe, I figured it out, thank you for your help..I appreciated it.. :)
Peter Ayad
Front End Web Development Techdegree Graduate 20,766 PointsHey I have tried unzipping file under user -> Peter -> IdeaProject and it is still giving me an error message:
public static void printChipmunksDeclaratively(List<String> chipmunks) { // TODO: Print out each of the chipmunks using the forEach method on Iterable chipmunks.forEach(chipmunk -> System.out.println(chipmunk!)); ^ } }
C:\Users\Peter\Downloads\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunk!)); ^ Im not sure what to do at this point?...any help would be appreciated. Thank you
Oshedhe Munasinghe
8,108 PointsAre you sure that you have unzipped the file to Ideaproject? because it replied here: C:\Users\Peter\Downloads\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24
it looks like you have opened the file from downloads..
Peter Ayad
Front End Web Development Techdegree Graduate 20,766 Pointshey I tried your method and was able to unzip it to IdeaProject, but it told me i had to update the gradle wrapper, then it still gave me the same error...
C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunk!));
} } sorry for the hassle..I just don't understand why it keeps telling me that there is an error?
Oshedhe Munasinghe
8,108 PointsHey!! I think maybe know the answer I think you have coded correctly but missing one little thing!! :) Please check this link: https://teamtreehouse.com/community/local-code-challengeusing-foreach
Peter Ayad
Front End Web Development Techdegree Graduate 20,766 Pointshello, I have unzipped to IdeaProject, I dont have an import option when i select file, only an export also, i tried importing setting and clicked on the ideaProject and It still gave me the same error, also I have tried using the method reference instead and also it says I have 3 tests completed and 1 failed, I also tried uninstalling intellij Idea and reinstalling it, still the same issue...
I also took a look at the link you gave me and it still giving me an error, do i have to do anything else besides using the lambda, like for example when it says to create a field named "chipmunk" on intellij Idea?
At this point im not sure why its telling me that there is an error, I have tried alot of options to try to get it to work, But im stumped, if there is a way to complete this task please let me know.. Thank you
Task :test
com.teamtreehouse.challenges.PrinterTest > printsProperly FAILED java.lang.AssertionError: The output from your method 'printChipmunksDeclaratively' seems wrong Expected: a string containing "Example1!" but: was "Example1 Example2 Example3 " at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:865) at com.teamtreehouse.teachingassistant.rules.Consoler.assertExpected(Consoler.java:61) at com.teamtreehouse.challenges.PrinterTest.printsProperly(PrinterTest.java:59)
3 tests completed, 1 failed
Task :test FAILED
Execution failed for task ':test'.
There were failing tests. See the report at: file:///C:/Users/Peter/IdeaProjects/lcc-java-fp-printer-1.1.0/build/reports/tests/test/index.html
C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ';' expected chipmunks.forEach(chipmunk) -> System.out.println(chipmunk!)); ^
C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunks!));
C:\Users\Peter\IdeaProjects\lcc-java-fp-printer-1.1.0\src\main\java\com\teamtreehouse\challenges\Printer.java:24: error: ')' expected chipmunks.forEach(chipmunk -> System.out.println(chipmunk!));
Oshedhe Munasinghe
8,108 Pointschipmunks.forEach(chipmunk -> System.out.println(chipmunk!));
You have coded almost correct in for each but it's a bit wrong! Look at this page: https://teamtreehouse.com/community/local-code-challengeusing-foreach
It should be System.out.println(chipmunk + "!"); try and let me know what the compiler saying.. :s
Todd Baker
17,207 PointsTodd Baker
17,207 PointsI was able to see the video run as a giph, but now I get this error when I run the task in IntelliJ:
Execution failed for task ':test'.
Any thoughts on how I can fix this?