Sun's Java installers used to sometimes (often) put a copy of java.exe into your C:\WINDOWS directory (or someplace along those lines) which is used by the Java Plug-in. This then leads to a situation where your path contains javac.exe from a JDK you've installed, but java.exe in C:\WINDOWS (or maybe in a JRE you've installed that's earlier on your path.)
In any case, examine your system closely; make sure that the java.exe you're running is the one that you expect. If it's not, then it won't be looking in that "ext" directory for extensions.
First of all, please don't call Ernest "Hill". It's not his first name nor his last name - it's part of his last name. If you go around calling people by their last name only (which is quite uncommon in Europe and the US), then at least use "Friedman-Hill". Or just be lazy and call him EFH like everyone else does
Now back to the problem. You may not be using the JRE you think you are. When you install the JDK, it actually installs 2 JREs: one inside the JDK folder (in a folder simply called jre) and one in C:\Program Files (usually). So if you have put them in C:\jdk1.5.0\jre\lib\ext, the other JRE (C:\Program Files\Java\xxxxx) will not see those libraries. You have to copy the files to that folder as well.
What I said was that the java.exe you're running may not actually be looking to the JDK extensions directory where you've installed iText.
And actually, I only said "may not" just to be nice, because I will actually guarantee you that what I've described is precisely the problem.
Joined: Oct 06, 2008
Thanks RP & EFH. Now after putting all the jar's in both the exts(JRE of program files & in C:\jdk1.5) it's working fine. If I have the jars simply in my classpath C:\jdk1.5\lib then it was throwing the same error at run time Why? Regards.
Note: Dear EFH please excuse me on your name I've used in the last post.
Joined: Oct 06, 2008
Now when I include the jar files in my classpath(C:\jdk1.5\lib) & compile , the program is not getting compiled. The error trace is:
It shows the some pdf related classes are not found, which is not the case when we include the jar in jre\ext. Why is this so?
2) But other normal built-in classes are working at runtime. How?
You should not be misusing JDK's /lib folder to place 3rd party JAR's in. It makes your application less portable. You would also get more trouble like as you're struggling with now when you're using multiple JDK's and/or ever going to reinstall or upgrade it.
Just use the -classpath or -cp argument for that.
And to execute it: To save effort in typing you can easily wrap in a batch or shell file, depending on the OS used. [ December 19, 2008: Message edited by: Bauke Scholtz ]
Thanks Bauke Scholtz & William Brogden for their valuable opinions. Now I've understood
Don't put third party jar in jdk\lib. Instead use i) javac -cp command or java -cp command. ii) ant by using the properties attribute to include third party jars.
Now now need two clarifications
You should not be misusing JDK's /lib folder to place 3rd party JAR's in. It makes your application less portable.
Now do you mean to say since the client's JVM & more specifically jdk\lib won't be having those third party jars , it makes our application less portable or is there any specific reasons.
To save effort in typing you can easily wrap in a batch or shell file, depending on the OS used.
A batch file is similar to a text file only difference being saved in the extension .bat. Here you are saying to wrap up the command javac & java in batch file. Okay but using this we can run only one class right .
You would also get more trouble like as you're struggling with now when you're using multiple JDK's
Can we use multiple JDK's in our application if yes normally in what situations they would opt for one