Jump to content
Excelsior Forums
Sign in to follow this  
wzhou

Can compiled DLL callable from Java ?

Recommended Posts

My java application using a Java library and I only want to protect this Java library. Can I just compile this Java library into DLL and my application code can still call those classes/methods in Java library ?

Share this post


Link to post
Share on other sites

Just to make myself more clear:

My java application using a special Java library and I only want to protect this Java library by compile it into native DLL using JET. Can I just compile this Java library into DLL so they are not only callable from other java code but also can be referenced from java code at development time. I don't need whole application as DLL or EXE.

If this can be done by JET, after JET compile, we should not only see the generated DLL, but also see those empty classes been converted from original Java library and they only contains method declarations but not implementations. Those implementations should be replaced by the reference to the native DLL.  How can I make this happen in JET ?

Share this post


Link to post
Share on other sites

Sorry but as far as I know this is not possible (the way you would like it to have) with JET.

Both JET and the JVM are isolated runtime enviroments which cannot work together that simple.

Transferring objects from one "JVM" to another is e.g. one example where this could cause many problems.

You could go through JNI like: Java compiled <-- JNI ---> C/C++ <----- JNI ----> JVM interpreted.

You could use serialization for object-transfer.

However from the performance Point of view such a design is not a really good idea - calling outside of java is quite expensive.

However JET has very good JIT compilers including even a JIT cache, so I would recommend deploying the whole application as JET compiled executable, and get JET to load all classes dynamically except your library.

lg Clemens

Share this post


Link to post
Share on other sites

Thanks for telling me this. 

I want people can develop their own java application using JET compiled DLL, eg [JET compiled DLL for Java Library] <--> JNI <--> [interfaces of Java Library] <--> [java application by others].

I think when someone want to protect their java code, they normaly only want to protect the library code.

I will workout something which will automatically generate those [interfaces of Java Library] and their JNI calls to JET compilled DLL. I will let everyone know when I finish. All suggestion are welcomed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×