File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes What is the BEST WAY to provide java code to vendor? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is the BEST WAY to provide java code to vendor?" Watch "What is the BEST WAY to provide java code to vendor?" New topic
Author

What is the BEST WAY to provide java code to vendor?

Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
Hi all,

I have two interfaces and its implementations Now I need to provide this interfaces to some third party vendor to use.
I dont want to share implementation details (Not even class files).
So what is the best way I can share this information?

I dont want to package my implementation details(Implementation classes) into the jar.

Appriciate for any hint or solution for this.







SCJP 6(83%), SCWCD 5.0(100%)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14266
    
  21

If you don't want to give somebody the implementation of your classes, then there is obviously no way for that person to run your program on their own computer in any way.

You can implement your program as a web service - it will be running on your own server, and the client will have to call it remotely.

You can try to obfuscate your code (make it hard to decompile), but this not safe in principle (a hacker who tries hard enough can always find it out, no matter how much you encrypt or obfuscate the code). Running it on a server, not giving third parties access to the code, is the only way to make it really safe.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
Hi Jesper,

One hypothetical solution is there in my mind.
Suppose my service class is located at remote location, now If I can load this class (Using ServiceLoader) into vendor machine at runtime from its remote location at first request and cache it so that there will be only a single hit. (Clear the cache as and when its necessary to do so)
Will this work?

Thanks Jesper for info about obfuscation.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39384
    
  28
Do you really mean vendor? Purchaser, surely?
Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
Hi Ritchie,

Yes, By this
I can load this class (Using ServiceLoader) into vendor machine at runtime
I actually mean it be a vendor.
Because the loading and caching will happen behind the scene at runtime and when user(vendor) kill or logs out of the application these things will be removed.

This is what I am just thinking about but dont know wether this will work or not.

Please help me to figure this.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It would be trivial to implement a class loader that saves your class files anyway.
Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
I have only two ways:
Either I use Web Services or I have to give source to the vendor.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14266
    
  21

Bhavesh Dak wrote:I have only two ways:
Either I use Web Services or I have to give source to the vendor.

You don't have to give the source to the vendor; you can give him compiled class files, but in principle he could reverse engineer those. The only really secure solution is to keep the class files to yourself and have the vendor call them remotely, for example through a web service.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the BEST WAY to provide java code to vendor?