Problem with Regex


General J2EE: Problem with Regex

  1. Problem with Regex (2 messages)

    Hi there. Im here concerning the java.util.regex class. The problem is that the class won't import! javac is throwing a non-recognised symbol error "regex". I get the same error from Tomcat aswel when I try to import the class in a JSP or Servlet.

    Is regex an extension to java? do I have to download any packages?

    PS: Im using J2SDK v1.4.2


    Threaded Messages (2)

  2. Problem with Regex[ Go to top ]


    java.util.regex is the _package_ containing the jdk regex _classes_ as java.util.regex.Pattern and java.util.regex.Matcher. To import the whole package, you have to use import java.util.regex.*;

    I recommend a good book about Java development in general.


  3. here is the fix[ Go to top ]

    You need to go to project properties and in the library tab locate the JRE System Library entry and hit edit. By default it uses an older jdk in the eclipse folder within WSAD. change it to use WebSphere v5.1 jre.

    Another thing tell the project to use the workspace compiler settings on the compiler tab in project properties. Then go to Window->preferences->Java->Compiler make sure it has 1.4 compliance turned on.

    This's what I had to do to get the import working for java.util.regex.*