|
|
Re: Load Jar from system variable [message #481481 is a reply to message #481374] |
Fri, 21 August 2009 08:14 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Sorry, my english is too ugly.
Are you questioning about this?
http://www.javaworld.com/javaworld/javatips/jw-javatip70.htm l
Rahul wrote:
> Hi All,
>
> I have developed an Eclipse RCP product which makes connection to
> oracle,db2 and other databases. I have packaged all the jars in the
> product itself every thing works fine.
> But now I can't pack the jars in the product I have to read it from the
> system on which the product is running. Even i cannot make jar as
> plugins. I can ask the user to specify the location of the jars. But my
> problem is how the jars will be loaded to make contentions. Currently I
> tried putting the jars path in environment variable but i did not get
> any success.
>
> please help me on how this can be achieved.
>
> Thanks,
> Rahul
>
|
|
|
Re: Load Jar from system variable [message #481483 is a reply to message #481374] |
Fri, 21 August 2009 08:25 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
I made some test code and it looks work.
But I can't sure What are you trying to.
// class pathes
URL[] url = new URL[] {
new URL("jar:file:C:\\Program Files\\Java\\jre6\\lib\\rt.jar!/")
};
// I gave parent class loader as this class's class loader
URLClassLoader myClassLoader =
new URLClassLoader(url, getClass().getClassLoader());
Class<?> stringBufferClass =
Class.forName("java.lang.StringBuffer", true, myClassLoader);
// creates StringBuffer instance from external jar
StringBuffer buffer = (StringBuffer) stringBufferClass.newInstance();
buffer.append("It works!");
System.out.println(buffer);
Rahul wrote:
> Hi All,
>
> I have developed an Eclipse RCP product which makes connection to
> oracle,db2 and other databases. I have packaged all the jars in the
> product itself every thing works fine.
> But now I can't pack the jars in the product I have to read it from the
> system on which the product is running. Even i cannot make jar as
> plugins. I can ask the user to specify the location of the jars. But my
> problem is how the jars will be loaded to make contentions. Currently I
> tried putting the jars path in environment variable but i did not get
> any success.
>
> please help me on how this can be achieved.
>
> Thanks,
> Rahul
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03075 seconds