I'm wondering whether its just me or if others have had trouble with this. I've searched the Interent and came up with complicated answer's. I'm trying to go through a JavaMail&James tutorial but I can't even set up the JavaMail API. I try to Set the CLASSPATH which seems to work because when I "echo %CLASSPATH" it comes back with the results that I input. Once I compile the program however the compiler tells me that: package javax.mail does not exist. I'm not sure whether its the setup problem or something else. I've placed the unziped folder of JavaMail into a folder called C:\JAMES_HOME\javamail-1.4ea. After this I added the mail.jar to the CLASSPATH like this: set CLASSPATH=%CLASSPATH%;c:\JAMES_HOME\javamail-1.4ea\mail.jar;. I have two questions: 1)Is the JavaMail API setup in the CLASSPATH and can I use it like this? 2)Is the compile error connected to this problem?
Here is the code of the program:
[ January 25, 2006: Message edited by: Hilton Meyer ]
Keep it Tidy
Joined: Nov 13, 2003
I solved the problem by copying the jar's into the jre/ext file. I would still like to know if there are other solutions.
I tried to use the javac command but the system said that this was not recognised. After reading a bit further in the article they suggested copying the jar's into the folder. It's no the best solution but it solved the problem for now. I would still like a solution so that in future I would not run into this problem.
Joined: Jan 21, 2006
Hi Pal, If u get a message saying command not recognised when u type javac then u have to set the PATH variable to the bin folder of java.
Letz say u have java in C:
then use set path=c:\j2sdk1.4.2\bin;.;%path%
After this set the classpath to the jars and try compiling.It should work
Joined: Nov 13, 2003
Thanks to evryone,
I fixed the problem by set the variables permanently in the Enviroment Variables in System Settings. Evrytime I was setting the paths up they would work but once I closed the command prompt window they would be reset to null. I'm not sure if I was doing it incorrectly but now they are permanently set up so there's no more hassles.
Thank you very much
Joined: Dec 06, 2001
It's not that you were doing incorrectly. However, you were not doing it permanently. It's good to hear that you got it working. Good luck with your programming project.
When you use SET in a command prompt it only affects that session.
Joined: Sep 24, 2003
Originally posted by Hilton Meyer: I solved the problem by copying the jar's into the jre/ext file. I would still like to know if there are other solutions.
I work on a J2SE implementation for my day job. A colleague recently proclaimed "do not put *anything* in jre/lib/ext unless you *really* know what you are doing". This is extremely useful advice - the amount of issues I have seen...
In any case, sounds to me like you simply need to use the -classpath switch.