2

I tried looking for a solution to this error but still can't use the class java.util.regex.Pattern, So I tried to make the import manually but I can only see three classes Matcher, MatchResult and PatternSyntaxException.

When looking in C:\Program Files\Java\jdk1.8.0_11\src.zip I can see the Pattern.java file, and I can see also the class Pattern.class when opening the JAR C:\Program Files\Java\jdk1.8.0_11\jre\lib\rt.jar.

Could someone help why Eclipse can't see this Pattern class?

This is the error as you can see it in Eclipse: enter image description here

Tarik
  • 4,961
  • 3
  • 36
  • 67
  • See if it help http://stackoverflow.com/a/21099229/460557 – Jorge Campos Oct 22 '14 at 15:53
  • thanks for your reply, i see that i dont have anything in the "Compatible JREs" side, even when i click on JavaSE-1.6... how can i resolve that? – Tarik Oct 22 '14 at 17:05
  • Click on add button, choose default jvm, then point it to your JDK enviroment, it normally are on c:\program files\java\jdk_xxx if you are on widnows – Jorge Campos Oct 22 '14 at 17:15
  • I am not talking about Installed JREs, i have jdk there ... but i am talking about "Window > Preferences > Java > Installed JREs > Execution Environments", when i Select JavaSE-1.6, i can't see anything on the right like what link you sent to me described – Tarik Oct 22 '14 at 17:31
  • The link I provided is about the JREs not the Execution Enviroment. These problems is normally related to the IDE with an embeded JRE. Thats why I pointed you to that link. I suggest you then to download another version of eclipse and import your project. – Jorge Campos Oct 22 '14 at 18:01
  • Ok and thx for your help Jorge, but i want also to tell you that i have many other classes complied and work fine, i just had that issue only when trying to use that Pattern class. – Tarik Oct 22 '14 at 18:03

1 Answers1

1

The problem was due to the JDK I was using, probably a corrupted file or installation issues, I tried another JDK version (1.6) and its working fine now.

Tarik
  • 4,961
  • 3
  • 36
  • 67