aspose file tools*
The moose likes Java in General and the fly likes is it possible!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "is it possible!!" Watch "is it possible!!" New topic
Author

is it possible!!

Patric Roice
Greenhorn

Joined: May 06, 2010
Posts: 7
I'm a newbee in java and recently started java programming professionally. the team I'm working wiith is from .net platform and they often need modules which is windows platfrom specific, like dll's
etc to build up a system/ software. is it possible to meet their requirement through java itself.??
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39884
    
  28
Welcome to the Ranch

You would get better answers if we knew what the thread it about.

It is possible to get at .dll files with the Java Native Interface (google for Java Native Interface or JNI), but that means one is platform-dependent. .NET is intended mainly to be run on Windows® machines. For platform-independence, the Java custom is for all requisite resources to be bundled in .jar files which can be distributed and are identical (just about) for Windows, Linux, Mac, etc.

You might be beginning Java but that isn't a beginning question, so I shall move this thread.
Patric Roice
Greenhorn

Joined: May 06, 2010
Posts: 7
Hii Campbell,

Thanks for your reply.. actually the subject matter is "how to work with dll's through java..". I've learnt something about JNI in google but never used.i'm rally confused what really it actually does!!
like.. how could i use a dll function using a java program.
If I'm seems to be foolish about it, java platform is not for me at all...may be.. I dont know.
thanks again!!

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Patric Roice wrote: "how to work with dll's through java..".


The JNI is what you need, its the Java Native Interface, which is how Java talks to foreign and native code.

The JNI documentation is hard for beginners in Java to understand, its fairly esoteric stuff.

More importantly, its not part of how 99% of all Java is written. The point of using Java is to have code that is platform independent, and nothing about JNI is platform independent, or even OS independent. Same with DLL usage, that is specific to Windows, and Java tries really hard to not do anything specific to any OS, be it Windows, Mac OS-X, Unix, Linux, Palm's WebOS, etc. And worse, JNI is specific to minor details of the implementation, it is different if you are running on an ARM or on a Intel x86 or an Intel Itanium. It quickly gets fairly messy.

These days, when folks build a system that has to uses lots of OS specific stuff, they typically design it to have the OS-specific stuff be a separate program/task/daemon, and talk to that from the Java application using normal TCP/IP protocols. When both programs are on the same machine, the TCP/IP connection is not too much of a problem with overhead. But it can be if you use it a lot or if you use it often.

I've been writing Java code professionally since about 1997, and I have not used JNI in ten years.
Patric Roice
Greenhorn

Joined: May 06, 2010
Posts: 7
Hii Pat,
thanks for reply...
That means, I should not proceed for that until I learn java better. am i right !!
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Learning more about Java is always a good thing.

There are Java ways to do a lot of things that a Windows programmer would do using a DLL. And the Java way avoids the evils of DLL-HELL that Windows developers and sys-admins know so well. But, there are specific Windows functions that you have to have a DLL do, so its hard to make general statements.

The last time I did use JNI, it was to read the internal structure of the directory of a music CD, which was down in the weeds. And if you have to do something like that, you don't have much choice.
Patric Roice
Greenhorn

Joined: May 06, 2010
Posts: 7
if there are no choice, then why people choose java, to program with windows because most of the cases they need to handle windows files like dll, ocx etc. could you please explain!
thanks.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Patric, your questions are too general. What specifically do you think you need a DLL for that you can't do in Java?
Patric Roice
Greenhorn

Joined: May 06, 2010
Posts: 7
sorry!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: is it possible!!