Results 1 to 7 of 7
- 02-24-2011, 02:06 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 2
- Rep Power
- 0
How import statements are included
Hi Friends
I am new to Java. I have a simple program wherein I am try to use some regex functions and it works fine. But, I am not able to understand how the import statement works.
My program has the following import statement:
And this regex is inside a jar file which is located in C:\Program Files\Java\jdk1.6.0_07\jre\lib\rt.jar. My CLASSPATH variable is not set and is empty.Java Code:import java.util.regex.*;
My question is: When I run the java program, how is it able to find out that my regex is inside rt.jar which is in so and so path since we dont have anything pointing to the location?
- 02-24-2011, 03:33 AM #2
Member
- Join Date
- Mar 2009
- Posts
- 70
- Rep Power
- 0
May be the IDE your using is pointing to that JAR file, or there is another one your are unaware of. Fairly sure that path is also the default (not sure, on Linux myself).
- 02-24-2011, 04:07 AM #3
Member
- Join Date
- Feb 2011
- Posts
- 10
- Rep Power
- 0
yes ,rp181,I think you are right,
the IDE has contain the jar
- 02-24-2011, 04:44 AM #4
- 02-24-2011, 08:21 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,458
- Rep Power
- 16
rt.jar is the basic runtime jar, containing all the standard java classes.
If you can run java programs then that jar file is accessible by the JVM.
- 02-24-2011, 08:45 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
rt.jar, as well as a large number of additional jars are on the bootstrap classpath which is based upon the directory in which the executing java command resides (unless you change it on the command line), and many other jars (a directoriey actually) are included as part of the "extension dirs" property which is also predetermined, and configurable, in the same manner.
Edit: There is also a bootstrap extension property, but that, normally, is empty.
- 02-25-2011, 12:52 AM #7
Member
- Join Date
- Feb 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
error - I think involving my Import Statements
By Sparky in forum New To JavaReplies: 2Last Post: 02-02-2011, 02:31 PM -
JDBC code not included into JAR file??
By friday in forum Advanced JavaReplies: 1Last Post: 12-17-2010, 07:13 PM -
Classes from included jar libraries are not available in Axis 2
By jeremycod in forum Advanced JavaReplies: 0Last Post: 10-31-2010, 08:51 AM -
Included file throws error.
By killerf2006 in forum New To JavaReplies: 3Last Post: 08-20-2010, 11:18 AM -
Problems with packages (import statements)
By ai_2007 in forum Advanced JavaReplies: 1Last Post: 06-29-2007, 11:57 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks