Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

DLLs in Java

Posted on 2006-04-10
11
Medium Priority
?
487 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:rats54
  • 6
  • 5
11 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 16418445
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
 

Author Comment

by:rats54
ID: 16418790
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
 
LVL 24

Expert Comment

by:sciuriware
ID: 16425732
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rats54
ID: 16426016
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
 
LVL 24

Expert Comment

by:sciuriware
ID: 16428154
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
 

Author Comment

by:rats54
ID: 16428189
I talked to people and found answer..."interface" provide runtime method implementations!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 16433550
That's no answer to your question or you asked the wrong question.

;JOOP!
0
 

Author Comment

by:rats54
ID: 16478804
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
 
LVL 24

Accepted Solution

by:
sciuriware earned 200 total points
ID: 16479962
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
 

Author Comment

by:rats54
ID: 16480054
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
 
LVL 24

Expert Comment

by:sciuriware
ID: 16480703
My last answer was final ..................................................................................
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
How does storytelling impact the web? What goes into a great story on the web? And how can it be used for marketing purposes? All of these questions will be answered.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question