Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6860581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:25:35+00:00 2026-05-27T02:25:35+00:00

I am typing this at the PowerShell command line: java -jar closure-compiler.jar –js temp1.js

  • 0

I am typing this at the PowerShell command line:

java -jar closure-compiler.jar --js temp1.js --js_output_file temp2.js

and it generates this error output:

temp1.js:359: WARNING - Suspicious code. The result of the 'getprop' operator is not being used.
$acms.x
^

0 error(s), 1 warning(s)

(I know exactly what’s wrong with the JavaScript: that’s not the issue here.)

I want to capture this error output. However, if I try:

$errs = java -jar closure-compiler.jar --js temp1.js --js_output_file temp2.js

$errs ends up empty. But then if I try:

java -jar closure-compiler.jar --js temp1.js --js_output_file temp2.js 2>errs.txt

errs.txt captures this:

java.exe : temp1.js:359: WARNING - Suspicious code. The result of the 'getprop' operator is not being used.
At line:1 char:5
+ java <<<<  -jar closure-compiler.jar --js temp1.js --js_output_file temp2.js 2>errs.txt
    + CategoryInfo          : NotSpecified: (temp1.js:359: W...not being used.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

$acms.x
^



0
 error(s), 
1
 warning(s)

Clearly the error output from the closure compiler is getting interleaved with PowerShell error output.

Is there any way to just capture the closure compiler output?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:25:36+00:00Added an answer on May 27, 2026 at 2:25 am

    If you are doing:

    $errs = command 2>&1
    

    $errs.Exception will give you the message.

    If only the error ( and only one) occured, $errs will have an ErrorRecord and you will be able to do the above and get the error that you want.

    Otherwise, it will be an array of errorrecords and / or normal output.

    So you will have to do

    $errs | ?{$_.GetType().Name -eq "ErrorRecord"} | select -expand exception

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using command line git with Java. Our project has tons of nested packages which
In my current project I end up typing this line a lot Then show
I have this horrible habit of typing the below and not catching it until
How many times has this happened to you? You are typing a long block
Typing Ctrl+O twice in editor when a java type is selected pops-up an outline
Is there a better way of debugging in Rhino than typing this everytime? :
I'm using Pylons with Mako templates and I want to avoid typing this all
Sometimes I seem to be quite inefficient. When I was nearly finished typing this,
I've noticed something peculiar about Visual Studio. First, try typing this (C#) somewhere in
I know that you can align UILabels in the center by typing this code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.