File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Java for system adminstration? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Java for system adminstration?" Watch "Java for system adminstration?" New topic
Author

Java for system adminstration?

Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

Can I use Java for system administration in Linux like the way we
use c or Perl?


best regards,
omi


Back to Java , again.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8968
    
    9

*nix systems tend to use plain text files for configuration, so at first blush I'd say yes, Java may work. However, depending on your Linux distribution, Java support may be spotty (this should get better now that Sun has released Java on an open-source license).


[How To Ask Questions On JavaRanch]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16246
    
  21

It all depends on what "system administration" means. Certainly if you are set up to run Tomcat, JBoss or the like as core system services, you're already using Java for system administration.

If you mean for system control and maintenance, certainly - I could, for example, write a crontab maintenance utility in Java either as a standalone app or as a webapp.

The only real restrictions are portability and overhead. You can't reasonably use Java in an environment where a JVM has to be fired up everytime it's needed but the task requires that startup delays be kept minimal (or storage is at a premium). Of course, if you by into the type of stuff that BEA (among others) is playing with, Java is essentially part of the OS, so that overhead mostly goes away.

Portability wouldn't be an issue execpt for the half-baked noncompliant gcj implementations, but thanks to Sun's opening the doors, I expect that incomplete JVMs will join J++ in the dustbin of history before much longer.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

thanks bartenders for your replies.

But sir,How about system automation tasks ,for ex. copying registry file,
executing network commands,shell programming,executing asm code.

Can we do that like that we do with perl,c,bash scripts,and python like languages?

I know as a Java programmer it's hard to do low level tasks but just
for ending my curiosity I am asking the above question.

best regards,
omi sharma
[ August 13, 2008: Message edited by: omi sharma ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8968
    
    9

Some problems are better suited for scripting languages and some are better suited for object-oriented programming languages. Use the correct tool for the job. Picking the correct tool may take some trial and error until you get a sense of what the strengths and weaknesses of each are.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

While you technically can do anything with Java that you can do with any other language, I think this is a serious mistake. If you are the sysadmin, and will always be the sysadmin, then by all means, do what you like. But if there is any chance, however small, that the system will grow and be put in production, and managed by professional sysadims, then you should do it using the "when in Rome, do it the Roman way" approach.

For Linux, the Linux way is perl or bash scripts.

Plus, perl is a useful language to know. You can do many sysadmin things in five lines of perl that would take many times as much in Java.

p.s. you are showing your Windoze biases talking about "registry" as there is no such think in Linux, BSD, etc. All that stuff is kept in ascii text files.
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

Great replies, thanks for your suggestion and I have known what should I do.
You guys replied very well specially Pat,ending my curiosity ,I am completely satisfied.

I will learn Perl and Python too but after finish some Java stuffs.

best regards,
omi
[ August 13, 2008: Message edited by: omi sharma ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java for system adminstration?