tags:

views:

344

answers:

7

Want to create animation dll for Window XP Is it ok to create Java2d animation and export as dll??

+1  A: 

I am pretty sure you can only create .Jar files from java not dlls

James
One of us is answering the question he means to ask, but I have no idea which one of us :-)
bmargulies
I am pretty sure its you +1 for the answer :)
James
@bmargulies: +1 for you too :P
o.k.w
Well technically I did answer his question, but you provided a solution to what he is looking for which in my eyes is better than mine!
James
@both of you: I fear that the OP expected a magic bean that would grow into a DLL from Java code without having to write C++, so in some I'm going to return the favors.
bmargulies
magic java bean? Muahahah
o.k.w
+11  A: 

Yes. You need to write code in C++ to start the JVM with the invocation interface to JNI, and call into it. However, you may find it difficult to create windows in this way that integrate seamlessly with your Windows environment application to display your animation. This is a rather advanced JNI usage, and I'd recommend reading the JNI book before even trying a little bit of it.

bmargulies
While technically correct, it's really not a good idea(mildly put) to use Java for the job described in the question above.
Marius Burz
True. There would have to be an awfully special reason. Just preferring to code in java2d versus native wouldn't do it.
bmargulies
+2  A: 

I doubt so, unless there's some 3rd party tools out there. For your case where graphics is involved, chances are even lower.

o.k.w
+1  A: 

I agree with bmargulies. It's probably feasible for an expert, but it would be a large DLL and you'd be mixing technologies that were never made to work together. It doesn't make sense to try this, in my opinion.

Carl Smotricz
+1  A: 

No, IIRC you can't. DLLs are linked directly when loaded. Java code needs a jvm, so you can only provide a dll that starts a jvm and starts code there, but not all necessarily stuff fits in the dll.

You should not do this. It looks like you're trying to use the wrong approach for your problem.

Patrick Cornelissen
+1  A: 

There are "bridges" that allow Java and non-Java code to call into one another. Depending on what you are trying to accomplish, these might be useful as you could write your Java code and then call into it from a C++ or C# DLL, depending on which language you are creating your DLL with, which will also determine what kind of bridge you need. I have never seen a freely provided bridge though. All the ones I've found when looking had to be purchased.

AaronLS
A: 

Well…

  1. GCJ is available for Windows.
  2. GCJ is part of GCC.
  3. GCC can create dlls.

It might be possible to put that together to build DLLs using GCJ.

David Dorward
But GCJ still produces class files right? And that means they need a JVM
Patrick Cornelissen
according to http://www.autexier.de/jmau/dev/gcj.html gcj still produces class files
Patrick Cornelissen