Load Jar from system variable [message #481374] |
Thu, 20 August 2009 16:38  |
Eclipse User |
|
|
|
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 #481481 is a reply to message #481374] |
Fri, 21 August 2009 08:14   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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
>
|
|
|
Re: Load Jar from system variable [message #481508 is a reply to message #481483] |
Fri, 21 August 2009 10:36  |
Eclipse User |
|
|
|
Thanks for the reply,
I got success in connecting to oracle and db2 but when i connect to main
frame it give me some error.
Actually for connection to db2 and oracle we just need to load one jar for
each but for connecting to mainframes we to load three jars one normal and
other two license jars. I am able to connect to mainframe when i add jars
to run time class path for the plugin. But for actual purpose I cannot do
that as i have to read the jars from the location provided by the user.
Thanks,
Rahul
|
|
|
Powered by
FUDForum. Page generated in 0.05170 seconds