• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

java program that can run a .class file in msdos, is this possible?  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

I'm going to develop a very simple compiler for a very simple programming language (developed by my Instructor) using java just to illustrate the very basic principles of programming languages. My problem is that i don't have an idea on how a java program execute another java program or how could my program automatically open an ms-dos window and run a .class file on it. I don't even have an idea if this is possible. Any advice?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi you can make a .bat file for this
 
Marshal
Posts: 60867
190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a job for Superman, no sorry Runtime.getRuntime().exec().

And make sure you understand the problems in the link, and also know about the newer ProcessBuilder class before trying anything.
 
Rey Fernandez
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a batch file? how? if that is possible using a batch file how could my java program run the batch file?
 
Sheriff
Posts: 21503
96
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With using ProcessBuilder and Process of course. Haven't you followed Campbell's links? Especially the first one is a must-read.

As for opening the MS-DOS window, that is an application called CMD.EXE. Open a command prompt and type "cmd /?" for all options.
 
Rey Fernandez
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you so much guys.....
 
Ranch Hand
Posts: 686
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sohan Badaya wrote:Hi you can make a .bat file for this




This sort of stuff makes me yearn for the good old days of Windows 3.1. Change one line in your buddy's win.ini and you can boot anything heh heh.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!