File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.util.regex?

 
Douglas Kent
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm trying to use the regex class and cannot find it in the downloaded j2se1.4 from java.sun. Has anyone been able to get this to load? Which jar file?
thanks,
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dougles,
I'm suprised that you're having this probem: I didn't. Can use, say, java.util.*?
M
 
Douglas Kent
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, can use java.util, just not java.util.regex.Pattern.
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to eliminate the obvious: did you do a java -version ? Did you reboot after the install? And if so, what exact error message are you getting?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, it does seem most likely that though you've downloaded 1.4, you're still running 1.3. It's also possible that the java command runs 1.4, but javac could point to 1.3. (I'm not sure why, but I've seen it happen.) Try temporarily renaming the directory your old 1.3 version is in, to see if you're still using anything in it without realizing it. You may need to hand edit the system PATH to find j2sdk1.4.0\bin, which is where your java commands should be.
To answer another question, you can probably find the Regex class in j2sdk1.4.0\jre\lib\rt.jar. That's for Windows anyway; it's probably about the same (except for the slashes) on unix.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your classpath environment variable look like?
 
Douglas Kent
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally found the class, but now getting another problem:
java.lang.SecurityException: Prohibited package name: java.util.regex
at java.lang.ClassLoader.defineClass(ClassLoader.java:477)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at sax.Splitter.main(Splitter.java:22)
HERE'S THE CODE:
import java.util.regex.*;
public class Splitter {
public static void main(String args[]) {
// Create a pattern to match breaks
Pattern p = null;
p = Pattern.compile("[,\\s]+");
"compile" is a static method of the Pattern class. Why would java do this check? Is this new in 1.4?
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doug,
IFIK, this is not a problem of 1.4. I've installed on over 150 (windows)machines, and it's been a pretty smooth ride. I suggest that you uninstall, then install again.
M
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic