0

Getting this kind of error on linux server in my project when i run my spring-hibernate project i read the

Increase permgen space

someone replied to execute

 -XX:MaxPermSize=128m

to increase of MaxPermSize but when i execute this command in in my project under directory of classes i got an error

[root@server classes]# -XX:MaxPermSize=128m
-bash: -XX:MaxPermSize=128m: command not found

Initial SessionFactory creation failed.java.lang.OutOfMemoryError: PermGen space

How can I set MaxPermSize only for one particular project as I am working on live server some projects are live on that server so please suggest me right solution so that I can set MaxPermSize on live server

Community
  • 1
  • 1
Kunal Batra
  • 821
  • 3
  • 14
  • 35

2 Answers2

2

You misunderstood the answer on the original question.

When you run a Java program, you use a command like:

java [JVM arguments] ClassName [program arguments]

The --XX:MaxPermSize=128m part goes in the "JVM arguments" part - it is a directive to the JVM to allocate 128m of memory to the PermGen.

So you are supposed to edit the java command in your script and not put that argument on a separate line.

You should also consider upgrading to Java 8, in which Permgen no longer exists.

RealSkeptic
  • 33,993
  • 7
  • 53
  • 79
  • it means to set MaxPermSize i have to execute command like java --XX:MaxPermSize=128m ClassName [program arguments] can u tell me what should i write in program arguments – Kunal Batra Apr 01 '16 at 11:01
  • 1
    @KunalBatra [program arguments] are the arguments the program expects as input. – Modus Tollens Apr 01 '16 at 11:12
  • okk i have executed export CATALINA_OPTS="$CATALINA_OPTS -server -Xms256m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=512m" on the server for now my projects are working fine thanx for your reply sir :) – Kunal Batra Apr 01 '16 at 11:17
1

-XX:MaxPermSize=128m is a JVM argument, not a bash command.

Raphael Roth
  • 26,751
  • 15
  • 88
  • 145