Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logging off a Linux Machine from a Java Program

Status
Not open for further replies.

napa1m

Programmer
Jul 24, 2000
39
TH
Hi, is it possible to log off a Linux machine from inside a Java program? I thought there might be two ways to do this:
1) Call the Logoff terminal command.
2) Or is there a way of coding it by calling an appropriate method?

Please help me! I've searched the web and tried looking it up in some Java books to no avail. Thanks alot everyone... Napa1m
hlechler@hotmail.com
 
I do not know if it would work or not, but you could try
Process p; //Need a process, getting another program
Runtime r=Runtime.getRuntime(); //Need the Current Runtime
p=r.exec("logout"); //Execute program (maybe a command as well?) from the current runtime.

I have no idea if would work logout being part of a shell, but you could try it.

JavaDude32
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top