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 Local Development Environments Exploring Your IDE Clean up this mess

Jarvis Chandler
Jarvis Chandler
7,619 Points

Now finally after running your code, please paste it in the Messy.java file and the results from the console in the resu

I am lost on this and need help?

Messy.java
import java.util.*;

public class Messy {
    public   static void main(String[]      args){
System.out.println("five");System.out.println("one");
    System.out.println("six");
    System.out.println( "four"       );     System.out.println("two");
    Please comment out this line and
    this line as well with a hotkey that does multi-line commenting
    List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
    for (String numberWord:         numberWords) {
      // Use the sout shortcut to write out numberWord;
      }
    }}
results.txt
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Didea.launcher.port=7538 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_91\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain ""
Exception in thread "main" java.lang.ClassNotFoundException: 
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)

Process finished with exit code 1

3 Answers

Simon Coates
Simon Coates
28,694 Points

You haven't done any of the suggested refactoring, or commented out a couple lines (That aren't legal java). The point of the exercise is to learn the IDE. The results.txt is meant to be a series of numbers. The java is meant to look something like the following (your IDE probably has better automatic style than I do).

import java.util.Arrays;
import java.util.List;

public class Messy {
  public static void main(String[] args){
    System.out.println("one");
    System.out.println("two");
    System.out.println("three");
    System.out.println("four");
    System.out.println("five");
    /* Please comment out this line and
    this line as well with a hotkey that does multi-line commenting */
    List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
    for (String numberWord: numberWords) {
      // Use the sout shortcut to write out numberWord;
      System.out.println(numberWord);
    }
  }
}

You can copy this, or just use it as a guide to the steps to take within your IDE. Up to you.

To successfully compleTe This seGmenT you musT pass all Tasks and deleTe or commenT ouT The packaGe sTATemenT in The Messy.java file. I Believe This is a securiTy issue reGardinG remoTe access To your local machine.

not quiet sure what you mean

The answer is : First, you need to sort the system out print one two three four by the command in windows ctrl+shift* + arrow **up or down . Thereafter you need to compile, copy the result and paste on the text file.

import java.util.Arrays;
import java.util.List;

public class Messy {
    public static void main(String[] args) {
        System.out.println("one");
        System.out.println("two");
        System.out.println("three");
        System.out.println("four");
        System.out.println("five");
    /* Please comment out this line and
    this line as well with a hotkey that does multi-line commenting */
        List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
        for (String numberWord : numberWords) {
            // Use the sout shortcut to write out numberWord;
            System.out.println(numberWord);
        }
    }
}