Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux(Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux)
Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #515342] Thu, 18 February 2010 14:22 Go to next message
Ibrahim  is currently offline Ibrahim Friend
Messages: 8
Registered: February 2010
Junior Member
Hi,

I am trying to launch one application through Runtime.getRuntime().exec()
but I am getting the exit code 127 return value on Ubuntu Linux box but no exception

I have all the path and environment variable set. Please guide what could be the problem

[Updated on: Thu, 18 February 2010 14:22]

Report message to a moderator

Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #515377 is a reply to message #515342] Thu, 18 February 2010 15:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

What exactly are you passing into your exec(*) ... that's what will
determine why you are getting back 127

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #515511 is a reply to message #515377] Fri, 19 February 2010 06:54 Go to previous messageGo to next message
Ibrahim  is currently offline Ibrahim Friend
Messages: 8
Registered: February 2010
Junior Member
I am launching one standalone GUI (Qt) application that is written by me. I have all the permissions set (i.e) chmod 777 and the owner & group settings to my login ID. But still I am getting this 127 during Process.exitValue().

Can anyone help me in this regard?
Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #515532 is a reply to message #515511] Fri, 19 February 2010 05:02 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Does your Qt application run into some error condition that causes it to
deliver a 127 exit value?

Steffen

On 19/02/2010 06:54, Ibrahim wrote:
> I am launching one standalone GUI (Qt) application that is written by
> me. I have all the permissions set (i.e) chmod 777 and the owner &
> group settings to my login ID. But still I am getting this 127 during
> Process.exitValue().
>
> Can anyone help me in this regard?
Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #515603 is a reply to message #515511] Fri, 19 February 2010 14:02 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ibrahim wrote:
> I am launching one standalone GUI (Qt) application that is written by
> me. I have all the permissions set (i.e) chmod 777 and the owner & group
> settings to my login ID. But still I am getting this 127 during
> Process.exitValue().

I didn't ask what you were launching, but how you are launching it.
It's important to answer the questions that other people ask while
they're trying to help you, otherwise the answer to "Can anyone help me
in this regard?" is *no*.

For example, sometimes you cannot launch a shell script directly from
exec(*) within java. Sometimes you need to launch it like "/bin/bash
/tmp/theShell.sh" as opposed to /tmp/theShell.sh which is what you would
type from within a shell. If you would have shown me what you were
passing into exec(*) we could eliminate that as a possible problem or
prove that was the problem.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #516538 is a reply to message #515603] Wed, 24 February 2010 11:30 Go to previous messageGo to next message
Ibrahim  is currently offline Ibrahim Friend
Messages: 8
Registered: February 2010
Junior Member
sorry for the late reply, I am trying to launch the application as follows:

Process proc= null;
		try {
			proc = Runtime.getRuntime().exec(application's full path);
			if (proc.waitFor() != 0) { /* error occurs */
				System.err.println("exit value = " + proc.exitValue());
			}			
		} catch (IOException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			System.err.println(e);
		}


I am getting this exit code only when I try to launch through my Eclipse code (IObjectActionDelegate: run() -- from context menu click).

But stand alone Java code successfully launches this application and I am getting exit code as 0. That is why I am bewildering

[Updated on: Wed, 24 February 2010 11:32]

Report message to a moderator

Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #516583 is a reply to message #516538] Wed, 24 February 2010 08:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ibrahim wrote:
> sorry for the late reply, I am trying to launch the application as follows:
>
> Process proc= null;
> try {
> proc = Runtime.getRuntime().exec(application's full path);


"exec(application's full path);" it's the applications full path that
matters.

1) Is it a shell script or shell script wrapper, or an ELF executable?

2) Does it depend on an LD_LIBRARY_PATH in your environment, that might
not be available to an RCP app?

3) If you use the exact same string in File(application's full
path).exists() do you get true?


I've seen documentation for various scripts: "If a command is not found,
the child process created to execute it returns a status of 127"

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Runtime.getRuntime().exec() returns exit code 127 on Ubuntu Linux [message #526829 is a reply to message #516583] Tue, 13 April 2010 08:03 Go to previous message
Ibrahim  is currently offline Ibrahim Friend
Messages: 8
Registered: February 2010
Junior Member
Paul Webster wrote on Wed, 24 February 2010 03:28

"exec(application's full path);" it's the applications full path that
matters.

1) Is it a shell script or shell script wrapper, or an ELF executable?

2) Does it depend on an LD_LIBRARY_PATH in your environment, that might
not be available to an RCP app?

3) If you use the exact same string in File(application's full
path).exists() do you get true?


I've seen documentation for various scripts: "If a command is not found,
the child process created to execute it returns a status of 127"

Later,
PW

Ans 1) the application is a ELF 32-bit LSB, dynamically linked executable

2) yes LD_LIBRARY_PATH is needed and it is set

3) yes, I am getting true condition during File(application's full
path).exists()
Previous Topic:How to know if a perspective is custom or predefined?
Next Topic:why "FileEditorInput" not found?
Goto Forum:
  


Current Time: Fri Mar 29 02:29:48 GMT 2024

Powered by FUDForum. Page generated in 0.02907 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top