skip to Main Content

I’m trying to open a large php project on netbeans 12.5.
Netbeans is installad as a snap module on ubuntu 18.04.

Every time I’m getting a heap memory limit exception and I see 8 cpu cores running to about 100%.

Is there a way to increase memory limit? Documentation I read refers to previous versions of netbeans and I can’t change netbeans.conf under snap filesystem.

3

Answers


  1. EDIT

    Like @skomisa said, If you can’t modify netbeans.config file, you can launch it from console like this:- netbeans.exe -J-Xmx50m.
    But its very hard to do it every time you start netbeans. So for that follow these steps:-

    • First go to the folder where you have your NetBeans shortcut.(In Start Menu Folder or Desktop).
    • Then right click the shortcut and in the target section, add -J-Xmx50m.

    See this image.👇👇

    Image1

    Image 2

    Original Answer

    Open your netbeans installation and go to etc folder. Then open netbeans.conf file.
    Then search for netbeans_default_options string. If you want 50 heap size then add the -J-Xmx50m to that string. If it is already present change the value of it.
    My file is like this:-
    (Removed comments)👇

    netbeans_default_options="-J-XX:+UseStringDeduplication -J-Xss2m -J-Xmx50m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.security=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-opens=java.desktop/java.awt=ALL-UNNAMED -J--add-opens=java.desktop/java.awt.event=ALL-UNNAMED -J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED -J--add-opens=jdk.jshell/jdk.jshell=ALL-UNNAMED -J--add-modules=jdk.jshell -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED -J--add-exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J--add-exports=java.desktop/sun.swing=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED -J--add-exports=java.management/sun.management=ALL-UNNAMED -J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED  -J--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -J--add-exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED -J--add-exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED -J--add-opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-opens=java.base/java.nio=ALL-UNNAMED  -J-XX:+IgnoreUnrecognizedVMOptions"
    
    # Default location of JDK:
    # (set by installer or commented out if launcher should decide)
    #
    # It can be overridden on command line by using --jdkhome <dir>
    # Be careful when changing jdkhome.
    # There are two NetBeans launchers for Windows (32-bit and 64-bit) and
    # installer points to one of those in the NetBeans application shortcut 
    # based on the Java version selected at installation time.
    #
    netbeans_jdkhome="C:Program FilesJavajdk-17.0.1"
    
    # Additional module clusters:
    # using ${path.separator} (';' on Windows or ':' on Unix):
    #
    #netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"
    
    Login or Signup to reply.
  2. This is how you can configure netbeans.conf with NetBeans 12.5 and newer Snap packages

    mkdir -p ~/snap/netbeans/current/etc
    cp /snap/netbeans/current/netbeans/etc/netbeans.conf ~/snap/netbeans/current/etc/netbeans.conf
    gedit ~/snap/netbeans/current/etc/netbeans.conf
    
    Login or Signup to reply.
  3. -J-Xmx50m worked fine for me with NetBeans 16
    Thanks a lot, I really didn’t what to do with it being so slow.
    I was ready to ditch netbeans, which I really used to like back in the days.

    Thanks again

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search