powershell The ‘<' operator is reserved for future use in Java

Question:

I’ve read many answers about this question but nothing was found about the comparison between two files, actually this is a sample of the book Algorithms based on BinarySearch, here is the source code

This sample utilizes a library made by the author of the book, which can be accessed via Algorithms, and the question is when I want to run this program via the PowerShell of windows,like the command

I got a problem like
error

actually I find a solution to run this code but is useless to solve it on PowerShell which requires me to use the commandline program written by the author of this book which can be download on the website of “algs4.cs.princeton.edu/windows/”, and it need to compile and run the program with the commandline like

it does work but I wonder if we can utilize the original CLI because I found someone can run the original code on the Linux operating system without problems.

Any help is appreciated, thank you.

Answer:

Have you tried prefixing the redirection with the --% operator? For example:

The command above prefixes your command with three things, let me explain them:

  • cmd invokes cmd.exe, which knows what you mean by <
  • /c tells cmd.exe to process one command following on the command line and then exit.
  • --% tells PowerShell to leave the rest of the command line alone, so that cmd.exe can deal with the < redirection.

This way you don’t need a command script.

Source:

powershell The ‘<‘ operator is reserved for future use in Java by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply