Hi,

I am new to Java.

Id like to know if I can use system commands in Java applications. Thanks in advance,


Jan

Hi,

I am new to Java.

Id like to know if I can use system commands in Java applications. Thanks in advance,


Jan

Sure

System.out.println();

:lol:

no....I mean like

system("reboot");

Can I use em?

whatever happened to trying?

Is there even a portable, cross platform way to perform a reboot in java?

Read the API doc for Runtime.

here is output

[jan@localhost hello]$ javac helloJava.java
----------
1. ERROR in helloJava.java (at line 7)
System("xmms");
^^^^^^
The method System(String) is undefined for the type helloJava
----------

yup, that's not the way to call things outside the JVM...

Is there even a portable, cross platform way to perform a reboot in java?

Of course not, as there is no platform independent way to do it at all (except for pulling the powerplug, and that's assuming there's no UPS attached).

Look into the Runtime.exec methods, as masijade suggested