Showing posts with label jvm. Show all posts
Showing posts with label jvm. Show all posts

Thursday, September 5, 2013

Install Jboss 5.1.0.GA to Windows 7

Today I am going to show you how to install Jboss 5.1.0.GA on  a Windows 7 machine.
1. First of all download the binaries from http://www.jboss.org/jbossas/downloads/
2. The downloaded file is a zip is named jboss-5.1.0.GA-jdk6.zip. As you can see it is a zip archive and not an executable.
3. Create an installation folder (I created one at C:\Program Files\Jboss) and extract the archive there.
4. Add the path to JBoss directory to JBOSS_HOME enviroment variable (picture 1). For me it is C:\Program Files\Jboss\jboss-5.1.0.GA








5. Add the path to JDK directory to JAVA_HOME enviroment variable (picture 1). For me it is C:\Program Files\Java\jdk1.6.0_31
6. Gongratulations! We are ready! Now to start the application server open a shell window using WinKey + R then type cmd and hit Enter.
7. Type
C:\Program Files\Jboss\jboss-5.1.0.GA\bin\run.bat  -b 0.0.0.0
Notice the parameter -b! This parameter assures that server isvisible from all computers inside the network.
7. If you want to see if the application server has started correctly, inspect the log output in the shell will it is loading. When the process is finished open a browser and type: http://localhost:8080/web-console/

Heap size for JVM - Invalid initial heap size

Two JVM options are often used to tune JVM heap size: -Xmx for maximum heap size, and -Xms for initial heap size. Here are some common mistakes made by developers while using them:
  1. Missing m, M, g or G at the end (they are case insensitive). For example,

    java -Xmx128 BigApp
    java.lang.OutOfMemoryError: Java heap space
    
    The correct command should be: java -Xmx128m BigApp. To be precise, -Xmx128 is a valid setting for very small apps, like HelloWorld. But in real life, I guess you really mean -Xmx128m
  2. Extra space in JVM options, or incorrectly use =. For example,

    java -Xmx 128m BigApp
    Invalid maximum heap size: -Xmx
    Could not create the Java virtual machine.
    
    java -Xmx=512m HelloWorld
    Invalid maximum heap size: -Xmx=512m
    Could not create the Java virtual machine.
    
    The correct command should be java -Xmx128m BigApp, with no whitespace nor =. -X options are different than -Dkey=value system properties, where = is used.
  3. Only setting -Xms JVM option and its value is greater than the default maximum heap size, which is 64m. The default minimum heap size seems to be 0. For example,

    java -Xms128m BigApp
    Error occurred during initialization of VM
    Incompatible initial and maximum heap sizes specified
    
    The correct command should be java -Xms128m -Xmx128m BigApp. Its a good idea to set the minimum and maximum heap size to the same value. In any case, dont let the minimum heap size exceed the maximum heap size.
  4. Heap size is larger than your computers physical memory. For example,

    java -Xmx2g BigApp
    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create the Java virtual machine.
    
    The fix is to make it lower than the physical memory: java -Xmx1g BigApp
  5. Incorrectly use mb as the unit, where m or M should be used instead.

    java -Xms256mb -Xmx256mb BigApp
    Invalid initial heap size: -Xms256mb
    Could not create the Java virtual machine.
http://avdheshsemwal.blogspot.com/2013/02/heap-size-for-jvm.html