This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
As I'm new, and I've to develop shell extension using java, that should work in all Operating system! I've no idea, Please help me by providing simple code. if Possible
Welcome to CodeRanch!
Please not note that this forum is NotACodeMill. Please provide your code (or at least what logic you are thinking about). Also, be specific about your requirements. By 'that should work in all Operating system' do you mean that it should run commands like ps, top, ls etc. on Windows? In my opinion, it's not that easy
What exactly is a "shell extension"; do you mean something like a Windows shell extension, where you could add things to the right-click popup menu of Windows Explorer when you right-click a file or directory?
It's not going to be easy to write that in Java, even if you would only want to do it for Windows. Java was designed to be platform-independent, which means that it has not a lot of built-in support for operating system-specific features such as shell extensions. It will most likely be impossible to do this in pure Java, without any native code.
If you want to make it work on all operating systems, that's going to be even harder. It might not even be possible to do a similar kind of thing on Linux or Mac OS X.
Regarding this Shell Extension<right click on any folder and our menu Item exist>, does c or cpp works for all operating system. So that I'll go for JNI?
Joined: Feb 28, 2012
Thanks for your reply,
I'm just try to gather sample code for generating this Shell Extension, So that I'll put it to every OS, Such as MAC, linux, and Windows. there are not such direct coding regarding this topic, but Still with the help of Ranch peoples I'll do it. any Idea or any clue. hope help full for me, to write such JNI version.
Amarhzb Salk wrote:does c or cpp works for all operating system
C and/or CPP works for (almost) all operating systems, but the problem is, C/CPP is not platform independent - i.e. code which works for Windows, won't necessarily work for Linux. Even going further, you'll have to compile respective code on corresponding operating systems (unlike compile once and run anywhere).
And even after this, you create system dependent libraries for those shell extensions, then all your Java code would be simply using JNI and making calls to functions from those libraries. So, anyway your application is not going to be platform independent, and hence I don't see any specific reason to use Java here. Better would be an application completely written in C/CPP.
I hope this helps.
Joined: Feb 28, 2012
it's true that c or cpp is not platform independent, So is it possible that for linux I'll kept as .so file for windows .dll files and MAC I've no idea, but still some .extension file in our application, So that when ever linux come to picture then .so file starts working. for windows .dll so on and so forth.
One more thing, is it mandatory to store .dll or .so file to client machine not at server side. if yes then...... any idea!
Amarhzb Salk wrote:So that when ever linux come to picture then .so file starts working. for windows .dll so on and so forth.
Yes. It is possible. Ultimately, it is your choice of course, but I still think that if more than 90-95% code is written in C/CPP, at least I don't see any advantage of using Java just for JNI
Amarhzb Salk wrote:One more thing, is it mandatory to store .dll or .so file to client machine not at server side. if yes then...... any idea!
Well, I'm not sure how and why shell extension and client/server environment is related with each other. Can you please clarify on this?
Joined: Feb 28, 2012
No, I'm not saying Client or server.... I'm discussing these things only to contribute an idea. So as off now I got an idea for .so and .dll file's first check which operating system client is using, then according to that operating system we need to provide an environment like .so or .dll and for mac something like that. I think I'm missing something.
Any way thanks for this great help, once develop with coding I'll share and come back to this topic again.