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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

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

shindemayur
14-Alexandrite

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?

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.

 

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

Announcements

Top Tags