aspose file tools*
The moose likes Beginning Java and the fly likes How To Get OS Version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How To Get OS Version" Watch "How To Get OS Version" New topic
Author

How To Get OS Version

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I am writing an app that uses some commands such as CMD.EXE and COMMAND.COM to do the same tasks. So I need to know which OS version the App is running on to determine which one I need to use. Is there a way to do this?
------------------
Happy Coding,
Gregg Bolinger


GenRocket - Experts at Building Test Data
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

The only thing I can think of right now is to parse the output of the DOS ver command.
Junilu

Junilu - [How to Ask Questions] [How to Answer Questions]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Is that not a similar command such as DIR which I would then need the correct CMD or COMMAND to execute it?
I guess I could try both and find out which one works and use it. Thought maybe there was a more programmable way to do it.
------------------
Happy Coding,
Gregg Bolinger
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

I don't know what I was thinking earlier...
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Ah, you kick butt. Thanks a lot!!
Another question. In the API anywhere does it tell what Strings are allowed in the getProperty() method?

------------------
Happy Coding,
Gregg Bolinger
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html#getProperties()
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Once again, you kick serious tail. Thanks so much!!

------------------
Happy Coding,
Gregg Bolinger
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Get OS Version