Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Invoking a Java File from CPO

I need to read a Java file from CPO. I found there is an inbuilt activity "Read Generic Java File" in CPO. But am not sure on what should be the target i need to point this activity to. Also, can i use the output of this Java file as an input to the other activities of CPO workflow?

Can anyone please help me on this? It would be really helpful if there are any examples for the same.

 

Thanks,

Anish

1 ACCEPTED SOLUTION

Accepted Solutions

You have a number of ways to

You have a number of ways to achieve this through one of other Operating System activities.

I am going to assume that your Java file (.jar?) is accessible (reachable) from either a Windows or Linux computer. And that you can actually "execute" it using java.exe on Windows or equivalent command line on Linux with appropriate switches.

You will need to:

1. Create a new target for the computer where the file is accessible. This would be either a "Windows Computer" or "Unix/Linux System". If your file is accessible on a Process Orchestrator server, you don't need to create a new target as one is created automatically. Note that Unix/Linux System targets require that SFTP is enabled/configured on the machine.

2. In the process (where you want to "execute" your Java file), you will need to add a new activity. The activity you add will depend on your needs. For Windows computer, this could be "Execute Windows Command" (for simple command line execution) or "Execute Windows Script"/"Execute Windows PowerShell Script" if you need to do more than just execute a command (e.g. load environment variables or create a config file). For Linux/Unix System you can use Execute Unix/Linux SSH Command or Execute Unix/Linux SSH Script respectively. Configure the activity to use java.exe or its equivalent to execute your java file.

3. The "Output" property of the activity you used in step 2 will be the output of your java file (plus possibly other data if you used more than a simple command execution). You can refer to the Output property of this activity from activities that follow.

Hopefully this explanation helps.

Thanks,

Svetlana

 

4 REPLIES

Hi, Anish! The Read Generic

Hi, Anish!

 

The Read Generic Java File activity is specific to SAP Java adapter, and requires an NetWeaver SAP server target to be configured in CPO. It is not a "generic" Java activity by any means. I am not sure that it would suit your needs anyway, since it looks like you would like to execute a "java" file, not read/parse it (which is what this activity is doing really: parsing a file).

 

Could you expand on your use case? Are you trying to execute a .jar file and get the output back or are you trying to do something else?

 

Thanks,

Svetlana

 

 

 

New Member

Hi Svetlana, Thanks for the

Hi Svetlana,

 

Thanks for the information. I would like to run a Java class using the variable values from CPO, or even just run a java class and get its output as input to the following activities in CPO.

Is this something possible?

 

Thanks,

Anish

You have a number of ways to

You have a number of ways to achieve this through one of other Operating System activities.

I am going to assume that your Java file (.jar?) is accessible (reachable) from either a Windows or Linux computer. And that you can actually "execute" it using java.exe on Windows or equivalent command line on Linux with appropriate switches.

You will need to:

1. Create a new target for the computer where the file is accessible. This would be either a "Windows Computer" or "Unix/Linux System". If your file is accessible on a Process Orchestrator server, you don't need to create a new target as one is created automatically. Note that Unix/Linux System targets require that SFTP is enabled/configured on the machine.

2. In the process (where you want to "execute" your Java file), you will need to add a new activity. The activity you add will depend on your needs. For Windows computer, this could be "Execute Windows Command" (for simple command line execution) or "Execute Windows Script"/"Execute Windows PowerShell Script" if you need to do more than just execute a command (e.g. load environment variables or create a config file). For Linux/Unix System you can use Execute Unix/Linux SSH Command or Execute Unix/Linux SSH Script respectively. Configure the activity to use java.exe or its equivalent to execute your java file.

3. The "Output" property of the activity you used in step 2 will be the output of your java file (plus possibly other data if you used more than a simple command execution). You can refer to the Output property of this activity from activities that follow.

Hopefully this explanation helps.

Thanks,

Svetlana

 

New Member

Hi Svetlana, The approach you

Hi Svetlana,

 

The approach you mentioned worked perfectly. Thanks a lot !! :)

79
Views
5
Helpful
4
Replies
CreatePlease login to create content