Google Answers Logo
View Question
 
Q: Compiling Java to WIN32 DLL's ( No Answer,   4 Comments )
Question  
Subject: Compiling Java to WIN32 DLL's
Category: Computers > Programming
Asked by: southof40-ga
List Price: $5.00
Posted: 02 Apr 2003 23:27 PST
Expires: 03 May 2003 00:27 PDT
Question ID: 185302
I would like to find some information and tools in the area of taking
Java code written by myself and compiling it so that it runs on a
WIN32 as a DLL (this DLL would then be registered as a COM object).

I do want to compile the Java so that it's in native WIN32 code I
don't want to just add a COM wrapper to the existing Java and allow it
to run within the JVM (in other words the resulting DLL should be able
to run on a WIN32 machine which has no JVM installeD)

So here's an example scenario let us say I have developed a Java
'Aeroplane' class. I want to be able to compile this code into a DLL
which I can then install on customers WIN32 platforms as a COM object.
ASP pages run within IIS on that WIN32 box should be able to
instantiate the Aeroplane object just as if it was developed in (say)
C++.  The same Aeroplane class would be able to be used (without any
changes to the code) in a 'normal' Java environment (ie making use of
JVM) on (say) a Linux machine.


A complete answer would bear in mind that Microsoft have just
announced that they having nothing more to do with Java/J++ so
solutions which use their tools are no use in the long term.

Please ask for clarifications if you want to.

Request for Question Clarification by studboy-ga on 02 Apr 2003 23:48 PST
No, Java is very much alive at Microsoft.  They are providing support
to bring J++/Java into .NET:

http://msdn.microsoft.com/vjsharp/jump/default.asp

Who else would you go with if you want Win32 binaries?  Microsoft is
King.

Request for Question Clarification by studboy-ga on 02 Apr 2003 23:50 PST
In fact, I predict in the very near future, Scott McNealy and Bill
Gates will have *no choice* but to work together.  It's all about
business, and money talks... egos aside!

Clarification of Question by southof40-ga on 03 Apr 2003 01:56 PST
I do seem to have missed or misunderstood the J#.net angle of
Microsoft future plans - I did think it was a bit odd but I understood
that dropping Java was some sort of spin-off/settlement from the
latest round in the Sun vs MS Java licensing issue.

At the end of the day however unless there is a JVM for J#.net which
is usuable on non-MS platforms I think you can see (with reference to
last sentence of third para of my question) that J#.net is not a
solution that will work for me.

By the way I'm not sure how far you're pulling my leg but I'm not on
some sort of anti-MS crusade I'm merely trying to ensure that I get
best use from the software I develop.

Request for Question Clarification by mathtalk-ga on 03 Apr 2003 08:08 PST
Hi, southof40-ga:

Code that runs in a Java Virtual Machine has a potential "portability"
advantage, at the expense of the speed of native code compilation. 
Microsoft, with the .Net initiative, aims to get many of the
advantages of Java (safety, memory management) plus native code
compilation.

However portability is not at the top of their list of things to do;
they're a Windows shop!  C# has many similiarities to Java in the
nature of restricting C++ syntax, and is often humorously called
"Cava".

While .Net libraries are often DLL's, they are not COM "objects". 
.Net has a new and better way for sharing code (less reliant on the
registry and with more robust versioning).

Would you want a researcher to outline the differences between Java
and J# and provide some links for further details?

regards, mathtalk

Clarification of Question by southof40-ga on 03 Apr 2003 15:19 PST
Hi Mathtalk - thanks for your comments on J# vs Java. Strange to say
but until I posted this question I wasn't even aware that J# existed.
However as I have added into the comments below I believe that
eadfrith-ga has provided me with what I need (via a comment) to answer
my question so thanks for your offer on outlining the differences
between J# and Java but I will pass for now.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Compiling Java to WIN32 DLL's
From: trentaussie-ga on 03 Apr 2003 01:55 PST
 
Hi - It certainly can be done. You should get your hands on the
Microsoft.net framework (if you can get Visual Studio.net as well that
would be better). Anyways I created a Java class project in Visual
studio. The class is an aeroplane (see below). After compiling it,
check the Bin directory of the project and there will be a dll file
there. From there you can import that dll to another project. You will
however need the Microsoft.net on your machine (this will come with
future versions of windows). All in all this will do what you want.

cheers


// simple aeroplane class

public class AeroPlane
{
	public AeroPlane()
	{
		//
		// TODO: Add Constructor Logic here
		//
		planeType = "jumbo";
	}
	public AeroPlane(System.String type)
	{
		//
		// TODO: Add Constructor Logic here
		//
		planeType = type;
	}
	private System.String planeType;
	public System.String getPlaneType()
	{
		return this.planeType;
	}
}
Subject: Re: Compiling Java to WIN32 DLL's
From: southof40-ga on 03 Apr 2003 02:01 PST
 
Hi Trentaussie - Thanks for your interest. In using Visual Studio.net
are you using  J#.net as mentioned by studboy ? If so (and I'd be
pleased to be corrected) I think I have the same problem I mentioned
in my clarification, that is that the J# code is  (at least
potentially) not sufficiently 'Javaish'that it will run in a JVM on a
non-WIN32 platform. However I speak from great ignorance when it comes
to J# so I'd be happy to hear other points of view.
Subject: Re: Compiling Java to WIN32 DLL's
From: eadfrith-ga on 03 Apr 2003 09:29 PST
 
As I understand it, you wish to write Java code that can 
be deployed on a standard java virtual machine (which rules
out the Microsoft .Net flavours suggested above) but that you
also wish to compile some or all of the classes into native
Win32 DLLs. 

This product will do what you require, but it costs $$.

http://www.excelsior-usa.com/jet.html

The folks at GNU also have a solution that's free but 
you'll need to be technically savvy to use it.

http://gcc.gnu.org/java/

Cheers.
Subject: Re: Compiling Java to WIN32 DLL's
From: southof40-ga on 03 Apr 2003 15:16 PST
 
Hi eadfrith-ga - You have understood completely what I am after and
the two suggestions you make seem like excellent ones. I haven't yet
had time to read all the associated material but both look as if they
would do what I would like to do so thank you very much. If you're a
google researcher please paste your comment in as an answer and so get
paid - if you are not a google researcher please accept my thanks.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy