aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Execute application from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Execute application from java" Watch "Execute application from java" New topic
Author

Execute application from java

Luca Verdi
Greenhorn

Joined: Feb 08, 2013
Posts: 10
Hi folks,
I'm trying to run this simple code:


but I get this exception:


The path is correct; luxconsole application is there so I don't understand this exception.
what I wrong?

thank you

bye
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

Try ./luxconsole
In Linux and Mac, the current folder (.) is hardly ever part of the PATH variable. So unlike in Windows, you need to include the path.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Luca Verdi
Greenhorn

Joined: Feb 08, 2013
Posts: 10
It works!
Really thank you.

bye
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

You're welcome
Luca Verdi
Greenhorn

Joined: Feb 08, 2013
Posts: 10
Ok, ehm..another stuff like first post;

I need to execute an LSF submit job command always from my Java app.

The command is:


where start_server is a batch script containing BSUB directives.

my code si the following:


I do not get errors but I verified that command is not executed!
Can you help me?

Thank you.
bye
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

You can't use <, >, |, && or ||, as those are not part of the commands. They are operators in your shell. Either do the file redirection yourself (using ss' getOutputStream() method), or execute the command through a shell. I'm not sure how to do it, but most shells (like bash) has an option to have it run another command.

Also, please read Please When Runtime.exec() won't before continuing. It'll help you prevent problems like hanging processes.
Luca Verdi
Greenhorn

Joined: Feb 08, 2013
Posts: 10
ok thanks!

using "bash -c" and in particular:



works!

Thank you for the answer

bye
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Execute application from java