cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

how to print output on Terminal instead of MethodServer from Java class?

shindemayur
13-Aquamarine

how to print output on Terminal instead of MethodServer from Java class?

HI, I am executing a java class from terminal in windchill environment. If I use System.out.println("Print this "); method , output gets printed in methodserver log file. I want this output to be printed on Terminal from which I executed my java file. How any I achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions

public static void printMessageToConsole(String message) {
MethodContext methodContext = MethodContext.getContext();
methodContext.sendFeedback(new StatusFeedback(message));
}

View solution in original post

6 REPLIES 6

public static void printMessageToConsole(String message) {
MethodContext methodContext = MethodContext.getContext();
methodContext.sendFeedback(new StatusFeedback(message));
}

Thank you @BjoernRueegg  This is working.

Hi @BjoernRueegg , Your solution is working … Thank you , I have a same requirement with a twist.

I am doing some processing I want to print processing % on console, 

e.g. Processing completed ---> 1%

       Processing completed ---> 2%

.

 

Instead of printing  this on next line, how can I overwrite it on previous ?

Sorry, that is beyond my knowledge.

okay,, Thank you for your support.

 

gobada
6-Contributor
(To:shindemayur)

I would avoid printing on the same line if I can, unless this is important and logging is not. If it must be done, one method would be to use print rather than println, and use \r to clear the previous value

Top Tags