Solved

library files

Posted on 2002-05-15
9
154 Views
Last Modified: 2013-11-23
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
Comment
Question by:sorty
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 7011469
 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
 

Author Comment

by:sorty
ID: 7011518
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
 
LVL 7

Accepted Solution

by:
yoren earned 100 total points
ID: 7011536
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
 

Author Comment

by:sorty
ID: 7011568
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 35

Expert Comment

by:girionis
ID: 7011572
>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
 
LVL 7

Expert Comment

by:yoren
ID: 7011628
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
 

Author Comment

by:sorty
ID: 7011677
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
 
LVL 35

Expert Comment

by:girionis
ID: 7013147
 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
 
LVL 5

Expert Comment

by:Netminder
ID: 7754152
Question abandoned; force-accepted.

Netminder
EE Admin
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now