Advertising (This ad goes away for registered users. You can Login or Register)

Java timer command?

Discuss about your favorite (gaming...or not) devices here. The most popular ones will end up getting their own categories
Programming discussions for your favorite Device
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
User avatar
Minimur12
Posts: 1097
Joined: Sat Sep 01, 2012 2:22 pm

Java timer command?

Post by Minimur12 » Wed Oct 10, 2012 8:44 pm

im not too big on programming but i like making little 40 line programs, that sort of stuff, and i was wondering if i could make myself a program that would log the computer off? or is that not possible ?? ive borrowed my brothers java book and im reading up on it now, but id rather have it laymans, and also
an example on using the timer command if you could, your a legend :) thankyou
Advertising
I'm not on the forum much, if you want to let me know about something, shoot me a PM!
ImageImage

User avatar
Xian Nox
Retired Mod
Posts: 2749
Joined: Fri Nov 05, 2010 5:27 pm
Location: Over the hills and far away

Re: Java timer command?

Post by Xian Nox » Wed Oct 10, 2012 10:14 pm

Minimur12 wrote:i like making little 40 line programs, that sort of stuff
40 line programs means nothing in regards to complexity.
Minimur12 wrote:i was wondering if i could make myself a program that would log the computer off? or is that not possible ??
Why would it be impossible?
Minimur12 wrote:ive borrowed my brothers java book and im reading up on it now, but id rather have it laymans, and also
an example on using the timer command if you could, your a legend :) thankyou
Timer?
Advertising

svenn
Posts: 66
Joined: Fri Dec 24, 2010 5:17 pm
Location: Belgium
Contact:

Re: Java timer command?

Post by svenn » Mon Oct 15, 2012 1:47 pm

In linux :
"man at"
"man shutdown"

In windows :
http://capitalhead.com/articles/restart ... -line.aspx

In mac :
use that fancy overpriced button. (also linux option would prolly work ?)

User avatar
Acid_Snake
Retired Mod
Posts: 3099
Joined: Tue May 01, 2012 11:32 am
Location: Behind you!

Re: Java timer command?

Post by Acid_Snake » Mon Oct 15, 2012 1:57 pm

svenn wrote:In mac :
use that fancy overpriced button.
:lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol:

on-topic:
if you don't care about OS-dependency then I suggest what svenn wrote, if you want your app to work on different OSs then find an OS-independant way, or maybe write some code to detect the OS and run the command according to what OS has been detected. An example, in python, would be:

Code: Select all

import sys
if sys.platform.startswith("linux") == True:
   # do something linux-related
elif sys.platform.startswith("win") == True:
    # do something windows-related
elif sys.platform.startswith("darwin") == True:
    # do something mac-related

vingt-2
Posts: 3
Joined: Thu Oct 18, 2012 5:05 am

Re: Java timer command?

Post by vingt-2 » Sat Oct 27, 2012 2:55 pm

Your question isn't really clear regarding what answer we should, or could provide you.

Regarding Timers in Java, they are are a way to send software interrupt to a class in order to schedule its thread execution. Unless you use complex thread timing for your 40 line program, you don't really need that. Keep on learning, and you'll use when you need it ;).

Post Reply

Return to “Programming and Security”