This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Get Programming with Java (MEAP only) and have Peggy Fisher on-line!
See this thread for details.
Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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: 62292
194
  • 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: 21560
100
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.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!