Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-21-2008, 12:42 PM
Member
 
Join Date: May 2008
Posts: 1
Rep Power: 0
apremanandh is on a distinguished road
Default Execute a jar command from a java program
Hi,

I need to execute a jar command from the java program. And also need, that jar command must execute in the place (path like "C:/Sample/ jar..") where specified. current i am using

In Windows,
String cmd = "cmd /c jar uf " + instalationPath + jarName + " " + param ;
Runtime.getRuntime().exec(cmd);

But, i am not able to use the same command for Linux, Solaris and Macintosh, please help to resolve this issue.

Any equivalent command are available?.Kindly Help Me.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 05-21-2008, 12:48 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,504
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Yes you can't.

Try something like,

Code:
Runtime.getRuntime().exec()
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-21-2008, 02:33 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 540
Rep Power: 3
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Default
You're using a prefix string "\\" in windows, which is i think is different from Linux, Mac and Solaris, try to search for it...
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully

Last edited by sukatoa; 05-21-2008 at 02:35 PM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-21-2008, 03:04 PM
Member
 
Join Date: May 2008
Posts: 5
Rep Power: 0
CompleteBeginner is on a distinguished road
Default
Quote:
You're using a prefix string "\\" in windows, which is i think is different from Linux, Mac and Solaris, try to search for it...
With regards sukatoa for cross platform isnt there the seperator keyword for this?
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an External Program through Java program Java Tip java.io 0 04-04-2008 03:40 PM
How to execute an External Program through Java program JavaBean Java Tips 0 10-04-2007 10:33 PM
Unable to execute command line command in java LordSM New To Java 1 08-08-2007 01:23 AM
Execute a new program in java mathias Advanced Java 1 07-31-2007 06:42 AM
Need to write a program to execute a list of system commands mdthahir Networking 1 07-27-2007 06:46 PM


All times are GMT +2. The time now is 08:25 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org