DLLs in Java

I m new to java programming. This is pretty basic question. How do I write plugins in java just like I do in C++. I have to convert all my code from C++ to java (including the plugins). In C++ i have a main program which dlopens a library/plugin. Since its a dlopen I dont need to have that library/plugin to compile my program. Now my Java program would have to do the same i.e dlopen a library which would be in java only (a jar file ?). So what do I need to do to eliminate compile / link  time dependancy on that plugin that ill convert to java. Any example would be helpful..thanks
rats54Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sciuriwareCommented:
I think you must redesign from the start:

you might see .jar files as libraries or .dll's but
most java programs are a .jar file with everything in it:
.class files, pictures, sounds, .... what ever you can think of.

In general it is not possible to convert C into JAVA.
I had to rewrite all my programs over 5 years.
But, in the end it was satisfactory.

;JOOP!
0
rats54Author Commented:
But I need to provide an interface where in I can do dlopen on client jar files during runtime, just like I did in C++ (using dlopen). Only difference, it would all be java so no JNI needed.
Is that dlopen kind of architecture even possible in java where i compile my java program and at runtime I use client's library/jar ?
0
sciuriwareCommented:
A kind of "dlopen" is automatically performed by JAVA if you only provide the .jar files in the command line
or the CLASSPATH. JAVA is quite smart.

;JOOP!
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

rats54Author Commented:
But do I need that jar file present during compilation of my java code ?
For example I have a main() where I call function mylib.logerror(). Now this class (mylib) is in a jar file which is NOT in CLASSPATH during compilation, but it is present during running. Would that work

Thanks for your help.....
0
sciuriwareCommented:
No, but the unpacked classes would be accepted.

With a .dll you need the definition file present.

With JAVA every .class is its own definition file; a .jar is a bundle of .class files.
;JOOP!
0
rats54Author Commented:
I talked to people and found answer..."interface" provide runtime method implementations!
0
sciuriwareCommented:
That's no answer to your question or you asked the wrong question.

;JOOP!
0
rats54Author Commented:
OK yea you are right it wasnt right answer....:O(... I was told to look at some code to figure it cout and that code doesnt even look java.....it has files with extn *vbw..hmm
0
sciuriwareCommented:
I think you should have a look at the basic JAVA tutorial at SUN:
             http://java.sun.com/docs/books/tutorial/index.html
Don't buy the books, click at left.

Just a short glance. Try to get the (different) idea of JAVA programming.
The rest is not difficult; but do not try to be a professional in more than 1 language.

;JOOP!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rats54Author Commented:
ok well... what answer do you want me to accept here...? As far as my knowledge in Java goes I dont know whats the correct way to acheive what I m trying.......
0
sciuriwareCommented:
My last answer was final ..................................................................................
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.