It's not a secret anymore!
The moose likes Beginning Java and the fly likes Not finding Packages when compiling (javamail) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Not finding Packages when compiling (javamail)" Watch "Not finding Packages when compiling (javamail)" New topic

Not finding Packages when compiling (javamail)

Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97

I'm trying to compile my class extending james's mailet GenericMailet. I think that my environment variables are not correct or something, because I am getting cannot find symbol
symbol : class Mail
location: package org.apache.mailet
import org.apache.mailet.Mail;

Continously. Below I have my environment variable. I thought that I have everything I need for JAMES's packages to be found in their jar's. I did read the faq on environment variables, so I feel I have the right environment variables set.

Please help,

.;C:\PROGRA~1\Java\jdk1.6.0\lib;C:\PROGRA~1\Java\javamail-1.4;C:\PROGRA~1\Java\javamail-1.4\lib;C:\PROGRA~1\Java\jaf-1.1;C:\MyJava\james-2.3.0\lib;C:\PROGRA~1\Java;;C:\PROGRA~1\Java\jre1.6.0\lib\ext\;C:\MyJava\james-2.3.0\lib;C:\PROGRA~1\Java\SAR-INF\lib;C:\PROGRA~1\Java\jdk1.6.0\lib;C:\PROGRA~1\Java\javamail-1.4\mail.jar;C:\PROGRA~1\Java\javamail-1.4\lib\*.jar;C:\PROGRA~1\Java\jaf-1.1\activation.jar;C:\PROGRA~1\Java\jaf-1.1\*.jar;C:\MyJava\james-2.3.0\lib\*.jar;C:\PROGRA~1\Java\james- 2.3.0.jar;C:\PROGRA~1\Java\*.jar;C:\PROGRA~1\Java\jre1.6.0\lib\ext\;C:\MyJava\james-2.3.0\lib\*.jar;C:\PROGRA~1\Java\SAR-INF\lib\mailet-2.3.jar;C:\PROGRA~1\Java\SAR-INF\lib\*.jar

Jimmy Die
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
You can't use wildcards like "*.jar" in classpaths. Every jar file needs to be listed individually.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

Note that you can't use "*" in the CLASSPATH; you have to explicitly name jars. This might be messing things up for you; try removing the wildcards.

Better yet, don't use CLASSPATH at all. Provide just the jars your program needs using the -cp or -classpath switches to the compiler and runtime. Too much work? Then use a script, or learn to use Ant.

[Jess in Action][AskingGoodQuestions]
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
I thought the * was valid, thanks for that heads up.

I'll also take your suggestion about the -classpath switch, and I am looking at ant also.

Thanks so much,
I agree. Here's the link:
subject: Not finding Packages when compiling (javamail)
It's not a secret anymore!