• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

library files

I'm trying to determine exactly which jar files I need for my program.
In my code I have import statements calling:

import javax.xml.parsers.*;
import org.w3c.dom.*;
import javax.servlet.http.*;

However, when building my code, and specifying the exact
classpath to my jar files, I find that I don't need the
jar files for javax.xml.parsers and org.w3c.dom.
Are these included automatically with the jdk somewhere
because why is my build not complaining that they are missing?

It complains if I don't have the javax.servlet.http class files but not the other two. Anyone?
0
sorty
Asked:
sorty
  • 3
  • 3
  • 2
  • +1
1 Solution
 
girionisCommented:
 Are you using any classes of the javax.xml.parsers and the org.w3d.dom packages? Because if you do not then there is no need for it to use them (and thus no complaints). If you are using any Servlet-related classes and the VM cannot find them then it will complain.

  Hope it helps.
0
 
sortyAuthor Commented:
I AM using classes of the javax.xml.parsers and org.w3d.dom
packages. Where can it be getting these files from if I'm not providing it.
When I compile using the -classpath option, it should only read from this path right? so even if I have the files in another path it shouldn't read it as long as I don't have them in my classpath environment variable.
0
 
yorenCommented:
The JDK 1.4 includes JAXP, SAX, and DOM, and therefore the packages you mention. If you try to run or compile on a previous JDK, you'll need to include a JAXP- and DOM-compatible XML parser. Many parsers include those packages within their own JAR. Others include them within a separate JAR.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
sortyAuthor Commented:
Hi Yoren,

thanks, I am using jdk1.4 and therefore that must be where
it is picking it up from.
Do you know where it resides in the jdk1.4 and what form it takes? eg if it is a jar file.
The reason I'm asking is that I tried looking for it.
I only have the jdk1.4\bin in my classpath and this only contains all the exe files.
How does it know where to find it?
0
 
girionisCommented:
>When I compile using the -classpath option, it should only
>read from this path right? so even if I have
>the files in another path it shouldn't read it as long as I
>don't have them in my classpath environment
>variable.

  Yes this is right. It will read from your classpath only your user-made classes or third-party APIs (the core Java classes are read by the VM even if the classpath does not point at them). So yes it will not read your other two files if your classpath is not pointing at them.

  But let me get your problem right. You are using the DOM classes even if you are not importing them and you are not putting the JAR file in the classpath? If yes then this is really weird.

  I think the latest version of JDK includes support for these classes but you would still have to import them in order to use them. Are you sure that your classloader doe snot look somewhere else first? Are your jar files under the /ext folder? If not then they will be presumed as part of the JDK or to have themselves been installed as extensions.
0
 
yorenCommented:
The classes are in jre/lib/rt.jar, which has all of the basic Java classes and is automatically included. The included parser is Crimson, which you can get separately from http://xml.apache.org/crimson .
0
 
sortyAuthor Commented:
girionis,
Its perhaps not so weird! I am NOT putting the path into my -classpath option (I don't even have the jar files), but I AM putting the import statement into my code.
Therefore, the problem was only where the compiler was reading the files if I didn't have them.

The answer is as voren said which is that they are automatically included into the jdk1.4.

0
 
girionisCommented:
 Yes, then this is the answer. They are bundled together with the  rest of the JDK1.4 classes. I thought you were using them without imporitng them.
0
 
NetminderCommented:
Question abandoned; force-accepted.

Netminder
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now