LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package) (https://www.linuxquestions.org/questions/programming-9/java-cant-find-package-but-path-set-correctly-j2se1-4-0-java-util-regex-package-18853/)

Ethan 04-18-2002 01:25 PM

Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package)
 
Hi. The Java 2 SDK includes a package java.util.regex. I'm trying to use it like this:

import java.util.regex.*;

Pattern p = Pattern.compile("abc");

But the compiler returns the error "Class not found."

Both my PATH and CLASSPATH include

/usr/local/j2sdk1.4.0/
/usr/local/j2sdk1.4.0/bin
/usr/local/j2sdk1.4.0/lib

I would be grateful for any help with this.

Thanks!

Ethan

Ethan 04-18-2002 05:02 PM

Problem solved. Turned out the kaffe compiler was installed on the system. Thanks to a suggestion on the Java Developer Connection forums, used find and rpm commands to discover it. Uninstalled it. Now the intended Java compiler is used.

Ethan

zmedico 04-18-2002 05:03 PM

You should only need the java "bin" directory in your PATH and thats it. No CLASSPATH or anything else required.

In the future you can check your java version like this:

java -version

This could also help:

which java




Ethan 04-18-2002 06:02 PM

Zemedico, thanks!

Ethan

jkk21 02-05-2004 07:45 PM

Ethan, can you tell me what you did to resolve your problem? Got any links that spell out the problem and fix? I seem to be having similar/same problem.

My compiler also craps out when using assertions too. Any idea on this one?

eric.r.turner 02-06-2004 09:55 PM

Quote:

Originally posted by jkk21
My compiler also craps out when using assertions too. Any idea on this one?
Sounds like you didn't use the "-source 1.4" option to javac. From the Sun web site:
Quote:

Unless you specifically request source mode 1.4 with the -source 1.4 flag, the compiler operates in source mode 1.3. If you forget to use this this flag, programs that use the new assert statement will not compile. Having the compiler use the old semantics as its default behavior (that is, allowing assert to be used as an identifier) was done for maximal source compatibility. Source mode 1.3 is likely to be phased out over time.
Check it out at http://java.sun.com/j2se/1.4.1/docs/...#compatibility


All times are GMT -5. The time now is 08:22 PM.