Using java.util.regex in JDK 1.3

C

Chris

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?
 
C

Christophe Vanfleteren

Chris said:
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.
 
S

sks

Chris said:
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.*
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top