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

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

SOLVED
Highlighted
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
Highlighted

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

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

View solution in original post

6 REPLIES 6
Highlighted

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

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

View solution in original post

Highlighted

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

Thank you @bmr  This is working.

Highlighted

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

Hi @bmr , 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 ?

Highlighted

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

Sorry, that is beyond my knowledge.

Highlighted

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

okay,, Thank you for your support.

 

Highlighted

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

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