cancel
Showing results for 
Search instead for 
Did you mean: 

Java exec

longdistance
Champ in-the-making
Champ in-the-making
Can we run java "exec" from alfresco?

Thanx
5 REPLIES 5

netqueen33
Champ in-the-making
Champ in-the-making
Is this what you're looking for?

Java Runtime

Hope this helps & good luck.

marco_altieri
Star Contributor
Star Contributor
It's a bit difficult to understand what you're looking for, but I will try.

Probably what you need is:

http://dev.alfresco.com/resource/docs/java/core/org/alfresco/util/exec/RuntimeExec.html

There are useful examples inside the Alfresco code. You can start studying how it is used inside the class:

http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/repo/content/transform/magick/Ima...

The class is instantiated and injected using Spring. Have a look at:

alfresco/WEB-INF/classes/alfresco/subsystems/thirdparty/default/imagemagick-transform-context.xml

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

If you are using this command, just to know there are some bugs with Alfresco 3.4D if you start some programs :

Process proc = Runtime.getRuntime().exec(commands);

http://forums.alfresco.com/en/viewtopic.php?f=10&t=37976#p111080

longdistance
Champ in-the-making
Champ in-the-making
Thanx all. I will try ur suggestions

medicalallan
Champ in-the-making
Champ in-the-making
In Java, this means employing the Runtime class exec() method. Like the fork(3) C function, Runtime.exec() allows you to execute a program; unlike fork(), it does not allow you to directly control the environment. Runtime.exec() provides a simple interface to platform-dependent utilities and applications, although at the expense of platform independence. In an environment where Java applications must coexist with other non-Java applications this will often be a valid trade-off.

In its simplest form, exec() is quite easy to use:

   Process p = Runtime.getRuntime().exec("/bin/ls");