작성일 댓글 남기기

[공유-서버] How to Increase Java Memory in Windows

Running Java applications in computers takes some memory during the process which is known as Java memory (Java heap). Frequently, it is necessary to increase that heap to prevent throttling the performance of the application. This is how to for Windows 7 and can be used in Windows XP and Windows 8/8.1.

  1. Go to Control Panel. Click on “Start” button. Then click on “Control Panel.”Start Button
  2. Select Programs. In the left side of Control Panel click on “Programs.” Pleas click on the “Programs” written with green color, not the “Uninstall a program,” which is in blue color.Find Programs
  3. Go to Java settings. In the next dialog click on “Java,” usually at the bottom of the other Programs; “Java Control Panel” dialog pop-up opens.Find Java
  4. Select “Java” tab. Inside the Java tab, click on “View” button. It opens the “Java Runtime Environment Settings”Find Java Tab
  5. Change amount of heap. In the “Runtime Parameters” column change the value, or if it is blank decide for the new value, of the Java memory.View Java Runtime Environment
  6. Modify the parameter. To modify the parameter, double click in the “Runtime Parameters” column and,Modify Runtime Parameter
    • type -Xmx512m that assigns 512MB memory for the Java.
    • type -Xmx1024m that assigns 1GB memory for the Java.
    • type -Xmx2048m that assigns 2GB memory for the Java.
    • type -Xmx3072m that assigns 3GB memory for the Java, and so on.
    • Please note, it begins with a minus sign and ends to an m.
    • Also note, there is no blank space between characters.
  7. Close the dialogue box. Click on “OK” button on the “Java Runtime Environment Settings” to close it.
  8. Close Java dialogue box. “Apply” button in the “Java Control Panel” has been enabled now. You should click on “Apply” to finalise the new Java memory. Then click on the “OK” button.
  9. Close the Windows 7 Control Panel.
  • No restart of the computer is necessary after modifying the Java memory.
  • This is a temporary memory which is available for Java applications when you are running them. It does not “steal” or permanently deduct from the memory of computer. It is only a guarantee for Java Virtual Machine.
  • The value you select depends on how much memory sticks you have in computer and how consuming is the application you like to run.
  • If Java cannot find enough memory it dispatches an “exception” message to the Windows as, “Exception in thread “main” java.lang.OutOfMemoryError: Java heap space.”
  • This method with some modification also can be used for Windows Xp
  • This method also can be used for Windows 8 and Windows 10.

출처 : http://www.messiahpsychoanalyst.org/wikihow/index.php/How_to_Increase_Java_Memory_in_Windows

설정 관련하여 아래 내용 참고.

자바 32bit에서는 최대 1.2~1.8기가까지 설정이 가능하고, OS별에 따라 설정 가능한 부분이 다르다.
32비트 사용은 이제 드물기 때문에, 추가 지원은 없을 것이다.

https://dgdg.tistory.com/entry/32-bit-JVM%EC%97%90%EC%84%9C-MAX-HEAP-%ED%81%AC%EA%B8%B0%EC%9D%98-%EC%A0%9C%ED%95%9C

JVM heap memory size 설정 관련

https://okky.kr/article/184717

[JAVA] 자바 환경변수 설정 (윈도우10)

자바 프로그래밍 환경 구축방법 입니다.

(자바 JDK 다운로드 방법은 여기서 안내 해 드립니다)

1. 자바 설치후 설치 경로입니다. 설치 경로는 설치 파일에서 설정 가능합니다.

2. [내컴퓨터 – 속성] 또는 [제어판\시스템 및 보안\시스템] 에서 왼쪽의 ‘고급 시스템 설정’ 으로 들어갑니다.

3. 시스템 속성 창입니다. ‘환경 변수’ 클릭

4. 환경 변수 창입니다. 시스템 변수의 ‘새로 만들기’ 를 클릭하여 시스템 변수를 추가할 수 있습니다.

5. 아래의 값을 추가합니다. (오타에 유의)

변수 이름 : CLASSPATH

변수 값 : %classpath%;.1

변수 이름 : JAVA_HOME

변수 값 : C:\Program Files\Java\jdk1.8.0_742

6. 시스템 변수 Path3 값을 추가합니다.

시스템 변수(S) 목록중 ‘Path’ 선택 후 편집 클릭, 새로 만들기(N) 클릭 후 아래의 값 추가

변수 값 : %JAVA_HOME%\bin

7. 실행 명령에서 cmd를 입력하거나 [시작 단추-오른쪽 버튼]에서 나오는 메뉴에서 명령 프롬프트를 실행합니다. 명령 프롬프트(cmd)를 실행하여 설정이 제대로 되었는지 확인합니다.

8. cmd상에서 java4 그리고 javac5 명령어를 입력하여 환경변수 입력이 제대로 되었는지 확인합니다.

cmd실행화면

java 명령어 입력시

javac 명령어 입력시

“javac는 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다” 

경고가 나오는 경우는 5번으로 돌아가서 입력된 값이 올바른지 확인 해 주시기 바랍니다.

  1. 마침표를 꼭 찍는다 [본문으로]
  2. Java 설치 경로, 버전에 따라 값이 변경되니 Java jdk를 설치한 폴더의 주소를 복사 붙여넣기 하자 [본문으로]
  3. 환경변수 PATH는 Windows가 명령 프롬프트상에서 실행파일을 찾는 경로의 정보가 된다. 따라서 여기에 실행파일의 위치를 등록하면 명령 프롬프트(cmd)에서 경로에 상관없이 프로그램의 이름을 입력하여 프로그램을 실행할 수 있다. [본문으로]
  4. 자바 런처 [본문으로]
  5. 자바 컴파일러 [본문으로]

출처: https://macchiato.tistory.com/9 [Cafe M]