Author Topic: Help Java substitute for QB's "Shell" statement.  (Read 3712 times)

0 Members and 1 Guest are viewing this topic.

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
I'm helping a friend of mine with his thesis (An OS algo simulation) and since we're out of time (Due on March) I'm making the demos in FreeBasic that could be called from Java using a "shell" subtitute.

Shell runs an EXE file and returns the control to the caller after the shelled program terminates.


Is there a way to shell in Java?

Thanks!!!

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Help Java substitute for QB's "Shell" statement.
« Reply #1 on: February 26, 2009 »
If you can call Windows API, then ShellExecute() will do it.

Also, java.lang.System.exec()
http://dmi.ensica.fr/doc/java/j2sdk-1_4_2-doc/docs/api/java/lang/Runtime.html
Looks like
getRuntime().exec("c:/testprogram.exe");
might work.

Jim
« Last Edit: February 26, 2009 by Jim »
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: Help Java substitute for QB's "Shell" statement.
« Reply #2 on: February 27, 2009 »
Muchos Thank you' s!!!! :clap:
Challenge Trophies Won: