Using java.util.regex in JDK 1.3

Discussion in 'Java' started by Chris, Nov 15, 2004.

  1. Chris

    Chris Guest

    We've written an app that depends on the regex capability in JDK 1.4, and
    now the app has to run under 1.3. Rather that do a rewrite to use another
    regex package, I extracted the java.util.regex.* classes from 1.4 and put
    them in their own .jar. If I put that .jar on the classpath, then everything
    compiles fine under 1.3. When I try to run the app, though, I get this error
    message:

    java.lang.SecurityException: Prohibited package name: java.util.regex

    I suppose I could change the package names in the regex source code and
    recompile, but I'd rather not, because then I'd have to distribute this new
    jar file, even when deploying under 1.4 or 1.5.

    Any thoughts on how to solve this problem?
     
    Chris, Nov 15, 2004
    #1
    1. Advertising

  2. Chris wrote:

    > We've written an app that depends on the regex capability in JDK 1.4, and
    > now the app has to run under 1.3. Rather that do a rewrite to use another
    > regex package, I extracted the java.util.regex.* classes from 1.4 and put
    > them in their own .jar. If I put that .jar on the classpath, then
    > everything compiles fine under 1.3. When I try to run the app, though, I
    > get this error message:
    >
    > java.lang.SecurityException: Prohibited package name: java.util.regex
    >
    > I suppose I could change the package names in the regex source code and
    > recompile, but I'd rather not, because then I'd have to distribute this
    > new jar file, even when deploying under 1.4 or 1.5.
    >
    > Any thoughts on how to solve this problem?


    First of all, what you did was probably against the terms of your license,
    you just can't take random pieces out of a JRE.

    Instead of trying to take out the 1.4 regex classes, use another regex
    package, like one of these:

    http://jakarta.apache.org/regexp/
    http://jakarta.apache.org/oro

    Porting your code to use one of these shouldn't be too much work.

    --
    Kind regards,
    Christophe Vanfleteren
     
    Christophe Vanfleteren, Nov 15, 2004
    #2
    1. Advertising

  3. Chris

    Chris Guest

    > Instead of trying to take out the 1.4 regex classes, use another regex
    > package, like one of these:
    >
    > http://jakarta.apache.org/regexp/
    > http://jakarta.apache.org/oro
    >
    > Porting your code to use one of these shouldn't be too much work.


    I came to the same conclusion. ORO seems to work pretty well, and the port
    doesn't seem very difficult (so far).
     
    Chris, Nov 15, 2004
    #3
  4. Chris

    sks Guest

    "Chris" <> wrote in message
    news:...
    > We've written an app that depends on the regex capability in JDK 1.4, and
    > now the app has to run under 1.3. Rather that do a rewrite to use another
    > regex package, I extracted the java.util.regex.* classes from 1.4 and put
    > them in their own .jar. If I put that .jar on the classpath, then

    everything
    > compiles fine under 1.3. When I try to run the app, though, I get this

    error
    > message:
    >
    > java.lang.SecurityException: Prohibited package name: java.util.regex


    That's because you're not allowed to name your packages java.*
     
    sks, Nov 16, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dhek bhun kho

    java.util.regex: Backreferences?

    dhek bhun kho, Jul 9, 2003, in forum: Java
    Replies:
    2
    Views:
    810
    dhek bhun kho
    Jul 9, 2003
  2. Roedy Green

    Re: java.util.regex.Matcher

    Roedy Green, Jul 30, 2003, in forum: Java
    Replies:
    0
    Views:
    382
    Roedy Green
    Jul 30, 2003
  3. Tom Maki
    Replies:
    4
    Views:
    588
    Tom Maki
    Oct 26, 2004
  4. Ake L
    Replies:
    7
    Views:
    4,305
    Ake L
    Dec 11, 2005
  5. joes
    Replies:
    2
    Views:
    1,061
    Daniel Pitts
    May 25, 2007
Loading...

Share This Page