The error I get when I hover over scan.useDelimiter("\n");
is: "The type java.util.regex.Pattern cannot be resolved. It is indirectly referenced from required .class files"
I have tried re-installing my Java and JDK. JRE system library jre8 is referenced in the Java build path of my project. It's the workspace' default jre. It has rt.jar in it, which I am told, should contain all I need.
When I hit run I get "Exception in thread "main" java.lang.Error: Unresolved compilation problem: at pack.Main.main(Main.java:15)
"
Line 15 only says public static void main(String[] args) {
The code with the error is in the main class, not in the main method though.
My goal with this piece of code is to read user input, all of it until user hits enter. The delimiter part is there because on default scan.next() stops at spaces, I want the entire line.
Yes, I have cleaned my project.
Eclipse version: Indigo Service Release 2 Build id: 20120216-1857
Some code:
import java.util.Scanner;
import java.util.regex.*;
private static void someMethod(){
Scanner scan = new Scanner(System.in);
scan.useDelimiter("\n");
String pass = scan.next();
}
What is my next step here?
EDIT: I'm getting a comparible error when using .contrains(String) on a String: The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
String test = "bla_bla";
if(test.contains("a_"))