Skip to content
Advertisement

linux ulimit with java does not work properly

I run code on linux ubuntu 17.10

JavaScript

this code returns “unlimited”

but whenever I run command from terminal I get 1024.

Why those numbers are different?

Advertisement

Answer

You get the same result if you run the same command from the command line:

JavaScript

This is because -c only looks at the argument immediately following it, which is ulimit. The -n is not part of this argument, and is instead instead assigned as a positional parameter ($0).

To run ulimit -n, the -n needs to be part of that argument:

JavaScript

In other words, you should be using:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement