The Artima Developer Community
Sponsored Link

Java Answers Forum
Java Native Code

1 reply on 1 page. Most recent reply: Mar 5, 2002 2:49 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Manish Agarwal

Posts: 1
Nickname: morphius
Registered: Mar, 2002

Java Native Code Posted: Mar 5, 2002 1:24 AM
Reply to this message Reply
Advertisement
Does somebody know any free compiler on net that
can generate DLLs and Exes from Java classes?
Also what is the difference between DLLs and Exes?


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Java Native Code Posted: Mar 5, 2002 2:49 PM
Reply to this message Reply
There are tools for compiling Java to an EXE, mentioned elsewhere and often on in this and the legacy Java Answers Forum. Just do a search.

I don't know about a tool to generate DLLs from Java.

A DLL is in some ways similar to an EXE, but by convention doesn't have a main() entry point, so it cannot be run stand-alone. (If written correctly, it can be "run" with a tool built into Windows call RunDLL, however). Also, a DLL will generally export functions for programs too call and may also contain resources -- herein lies the similarity to EXE which can also do these things.

JNI allows you to write Java code, then use a tool to generate C header files, write the C code for those headers and compile that to a DLL which can be called from Java. I suppose you could devise some scheme where you write a DLL which loads the JVM, runs a Java program that you wrote which uses some JNI to access the same or another DLL to comminicate back. Then you'd have a DLL which is using Java.

One final point about DLLs (and EXEs): it wouldn't be that feasible to simply compile a Java class to a DLL because DLLs are procedural, not object-oriented. They are just collections of functions. So the DLL would have to have some scheme to wire in the oo-aspect (like for each class Foo, it would need a newFoo() function and every non-static function would need an object parameter).

Flat View: This topic has 1 reply on 1 page
Topic: Stars Applet Previous Topic   Next Topic Topic: Computer Name using Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use