-
November 18th, 2003, 06:29 PM
#1
classloader question - same classes in 2 different jar files
Hi, i have a question about classloader:
I have few classes, for some reason, I have to put these classes in 2 different jar files, and both jar file will be in my class path. Will this cause any classloader problem? or any other problems?
e.g.:
I have
a.class, b.class, c.class.....z.class
I have to put above to both 1.jar and 2.jar
My class path is C:\lib\1.jar;c:\2.jar;c:\3.jar....
Will this cause any problems?
Thanks !!!
-
November 18th, 2003, 07:08 PM
#2
Is the package the same?
If not than the only thing that you will have to do is, provide the fully qualified package name when declaring variables. ie
Code:
ResultSet myResultSet = myStatement.executeQuery("SELECT * FROM SomeTable");
java.util.Date utilDate = new java.util.Date();
java.sql.Date sqlDate = myResultSet.getDate(1);
Notice that the package is specified (java.util and java.sql)
If the packages are the same, than you will run into problems
-
November 18th, 2003, 07:35 PM
#3
Yes, packages are the same.... what kind of problem I will run into?
Thanks.
-
November 18th, 2003, 09:26 PM
#4
I don't think that you will actually get errors, but the VM (Virtual Machine) will pick up the class it finds in the classpath first.
ie if your classpath is something like:
Test1.jar;Test2.jar
Where Test1.jar has the same classes and packages as Test2.jar, the VM will pick to the classes in Test1.jar and not Test2.jar.
I could be rong, I never tried it.
-
November 18th, 2003, 10:06 PM
#5
Yes, this is what I thought
-
November 19th, 2003, 05:21 AM
#6
i'd love to know why you need to put identical classes in 2 different jar files, and use both jars in your app. it sounds like your filesystem structuring could do with some re-thinking
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|