My rcp based launcher has launcher.exe which has some recursive call during class loading so getting a stack over flow error. To avoid it I have to increasing the stack size. but unable to launch the application through launcher.exe but works fine from a windows batch script
I found similar thread forum post about increasing stack size
but of not much help.
my eclipse.ini :
-startup
plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.401.v20161122-1740
-vmargs
-Xms256m
-Xmx2048m
-Xss4m
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+ScavengeBeforeFullGC
-Declipse.buildId=44.1.2
But strangely though through a windows batch script this works perfectly fine:
#echo off
java -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx256m -Xss2m -jar plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar -application xx.yy.zz.mm.application.application -showSplash splash.bmp
exit
Don't know why the -Xss agrument is not considered by eclipse.ini
environment : Windows7+eclipse Neon+ 64bit java1.8
xxx.product file has following entry for VM agruments:
<launcherArgs>
<vmArgs>-Xms256m -Xmx2048m -Xss4m
-XX:MaxGCPauseMillis=10 -XX:MaxHeapFreeRatio=70 -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:+ScavengeBeforeFullGC
</vmArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
<vmArgsWin>-Declipse.buildId=44.1.2
</vmArgsWin>
</launcherArgs>
I found oracle blog here so tried with -Xss4096k in ini file but of no luck yet! Don't know the difference between launching through ini and launching through the command line. looks as if both are same but surely they aren't.
Related
I see that tons of questions posted in SO and other sites to increase tomcat memory when outoferror occurs. But none of them looks the same because some of them said use CATALINA_OPTS and some said JAVA_OPTS. and the location mostly they said like bin/setenv.sh if no file created it.
I follow the above things and still could not set the memory correctly as expected.
I have created the setenv.sh file inside bin directory of currently using tomcat.But still heap space is not increased.
CATALINA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"
this is my content of setenv.sh and please anyone explain what is the problem here, and whether set or export need to use in setenv.sh.
Can any one guide me for this?
Please try to edit the bin/setenv.sh
export CATALINA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"
JAVA_OPTS is passed to all JVM processes running on the same machine.
Use CATALINA_OPTS if you specifically want to pass JVM arguments to Tomcat.
By using the ps -eaf | grep 'tomcat' in the terminal, we can confirm the values.
Eg.,
root 32451 1 99 13:57 pts/1 00:00:07 /usr/java/jdk1.7.0_79/bin/java
-Djava.util.logging.config.file=/opt/apache-tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC
-Djava.endorsed.dirs=/opt/apache-tomcat/endorsed -classpath /opt/apache-tomcat/bin/bootstrap.jar:/opt/apache-tomcat/bin/tomcat-juli.jar
-Dcatalina.base=/opt/apache-tomcat
-Dcatalina.home=/opt/apache-tomcat
-Djava.io.tmpdir=/opt/apache-tomcat/temp org.apache.catalina.startup.Bootstrap start
I try to split OpenStreeemMap which weights 350MB into smaller peaces using http://wiki.openstreetmap.org/wiki/OSMT. When I run it from cmd line it finishes in like 40s.
However, when I try to import it to Eclipse and invoke method it takes like 15 minutes or it stucks.
I set Xmx1024m and Xms256m in Eclipse run configuration. I tried to run command line from Java code but this also runs very slowly.
1) You can compare all the VM arguments:
[How to get vm arguments from inside of java application?
2) If you are interested, You can try JVMMonitor (Eclipse Market Place).
36128 osmt.Main --split ----index-file=D:/Splitter/Splitted/node2tn --output-dir=D:/Splitter/Splitted --tile-size=0.1 D:/Splitter/map
4696 -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -XX:MaxPermSize=256m
28344 it.polito.appeal.traci.examples.OpenStepsClose -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:61123 -Xmx1024M -Xms256M -Dfile.encoding=Cp1252
20748 com.sun.javaws.Main -secure C:\Users\xxx\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\45\3ca5a4ad-384499c4 -DcmxServerMode=ejb -Dorg.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB -Dorg.omg.CORBA.ORBSingletonClass=com.ibm.rmi.corba.ORBSingleton -Djavax.rmi.CORBA.StubClass=com.ibm.rmi.javax.rmi.CORBA.StubDelegateImpl -Djavax.rmi.CORBA.PortableRemoteObjectClass=com.ibm.rmi.javax.rmi.PortableRemoteObject -Djava.naming.factory.url.pkgs=com.ibm.ws.naming -Dcom.ibm.CORBA.enableClientCallbacks=true -Xbootclasspath/a:C:\Program Files (x86)\Java\jre7\lib\deploy.jar;C:\Program Files (x86)\Java\jre7\lib\javaws.jar;C:\Program Files (x86)\Java\jre7\lib\plugin.jar -Xverify:remote -Xmx512m -Xms128m
37200 sun.tools.jps.Jps -lvm -Denv.class.path=C:\Users\xxx\Desktop\JADE\;D:\Splitter -Dapplication.home=C:\Program Files (x86)\Java\jdk1.6.0_45 -Xms8m
28224 -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -XX:MaxPermSize=256m
So as we can see when I run it from Eclipse its task 28344 , when I run from cmd its probabaly 37200
Running latest SR of Indigo on Win7SP1.
One thing that I find frustrating sometimes is that Eclipse sometimes fails immediately on startup with a "JVM startup" error. It gives me a dialog with the Java command line, and just says it exited with code 1.
Up to today, I was able to start Indigo from my desktop shortcut using JDK 1.70_25. This morning I changed my ini file to reference 1.7.0_40 and restarted it. It failed immediately with that JVM startup error. It doesn't even write anything into the workspace log file.
However, if I first run a Windows cmd and then just paste the contents of my shortcut, it's able to start up without error.
It would really be nice if I could get some better diagnostics when it fails.
Here is my current STS.ini (Using SpringSource Toolkit):
-vm
C:/eclipse/Java/jdk1.7.0_40/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
com.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
384M
-vmargs
-debug
-Xverify:none
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-Dsun.lang.ClassLoader.allowArraySyntax=true
-Djava.net.preferIPv4Stack=true
-Djava.util.Arrays.useLegacyMergeSort=true
-Dosgi.requiredJavaVersion=1.5
-Xmn128m
-Xms768m
-Xmx768m
-Xss1m
-XX:PermSize=128m
-XX:MaxPermSize=320m
Here's the Eclipse shortcut:
C:\eclipse\springsource\sts-2.8.0.RELEASE\STS.exe -showlocation -data "c:\Users\<myuid>\workspace6"
And here is my PATH:
C:\Users\<myuid>\frameworks\apache-maven-3.0.5\bin;C:\eclipse\Java\jdk1.6.0_30\bin;C:\Cygwin\home\<myuid>\bin;C:\Program Files\CollabNet\Subversion Client;C:\frameworks\db-derby-10.5.3.0-bin\bin;C:\Cygwin\home\<myuid>\bin;C:\Cygwin\home\<myuid>;C:\Users\<myuid>\frameworks\apache-maven-3.0.5\bin;C:\eclipse\Java\jdk1.6.0_30\bin;C:\Cygwin\home\<myuid>\bin;C:\Program Files\CollabNet\Subversion Client;C:\frameworks\db-derby-10.5.3.0-bin\bin;C:\Cygwin\usr\local\bin;C:\Cygwin\bin;C:\Program Files\Voltage Security\Voltage SecureFile;C:\Program Files\CollabNet\Subversion Client;C:\Program Files\RSA SecurID Token Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Enterprise Vault\EVClient;C:\Program Files\Code Collaborator Client;C:\Program Files\nodejs;C:\Program Files\Voltage Security\Voltage SecureMail;C:\Program Files\Common Files\Voltage Security;C:\users\<myuid>\frameworks\phantomjs-1.9.0-windows;C:\Program Files\ATT Connect\OutlookAddin\Outlook;C:\Users\<myuid>\frameworks\sonar-runner-2.3\bin;C:\Users\<myuid>\AppData\Roaming\npm;C:\Cygwin\bin;C:\Cygwin\bin;C:\Cygwin\lib\lapack;C:\frameworks\jaxb-ri-20081030\bin;C:\frameworks\pmd-bin-4.3\bin;C:\Users\<myuid>\workspace4\WorkTreeConfig\target;C:\Users\<myuid>\sysinternals\junction;C:\Users\<myuid>\frameworks\apache-ant-1.7.1\bin;C:\frameworks\jaxb-ri-20081030\bin;C:\frameworks\pmd-bin-4.3\bin;C:\Users\<myuid>\workspace4\WorkTreeConfig\target;C:\Users\<myuid>\sysinternals\junction;C:\Users\<myuid>\frameworks\apache-ant-1.7.1\bin
It's very is very annoying when you get to spend something like it, maybe this guide can helps you.
I am getting the following error whenever i am trying to run a new Web Application created using Play.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
In Play framework 2.0.3, <play framework install dir>\framework\build.bat script you need to replace the command line argument for the command below
java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*
Into
java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*
Just downloaded and unzipped 2.2.1 on my Windows 8 computer.
Followed the documentation at Play Framework website, and ended up having the same issue as you. Adjusting the various parameters in the build file didn't do anything, but the:
java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*
... solved the problem.
I don't know where other people found this solution, but there's no mentioning of this solution on the Play Framework website. In fact, there's nothing to suggest that anything could go wrong. After all, it's just a file you need to unzip.
It's running now, however it's a little hard to trust a framework that screws up that early on. Seems the authors don't test on anything but Linux.
in 2.3 Play framework :
GO to :
C://Play2.3/framework/build.bat and open this file and make these changes.
Replace this line with below line.
java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*
java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*
then type this command on command promt:
C:\Users\k.ashish\Downloads\play-2.2.3\play-2.2.3\yourapp>play
C:\Users\k.ashish\Downloads\play-2.2.3\play-2.2.3\yourapp>run
If you are not able to execute this command then set the play2.3 framework path in Environment variable in windows like java path .
Synopsis:
I am trying to convert a shell script from UNIX to Powershell.
The script cannot "hardcode" the path, but must instead list a directory to dynamically build the path at runtime.
Also, the script must pass in 1 parameter to indicate the "type" of the run.
I am placing my "attempted" re-write of the script (after much googling/binging)
This script might be very close as the "echo" statements produced what seems to be correct.
$EXE_CLASS="com.sungard.sims.dacar.standalone.Dacar"
#$DACAR_TAG=%1
$JAVA_EXE="$ENV:JDK15\jre\bin\java"
#JAVA_EXE=\opt\java\bin\java
$JARS="dist\lib\Dacar-Engine.jar;dist\lib\Dacar-Common.jar;dist\lib\Dacar-Collector.jar;dist\lib\standalone-Dacar.jar;dist\lib\DACAR-CRG.jar;"
#dynamically append all .jar files from the jars directory.
ls jars\*.jar | % { $JARS +=";jars\"+ $_.name }
$JAVA_OPTS="-server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxTenuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=${DACAR_TAG} -DprocType=ENGINE"
echo "exe: -> $JAVA_EXE"
echo "opts: -> $JAVA_OPTS"
echo "jars: -> $JARS"
echo "class: -> $EXE_CLASS"
& $JAVA_EXE $JAVA_OPTS "-classpath .\configuration;$JARS $EXE_CLASS 1> dacar.out 2> dacar.err"
please note that I have commented out the use of the DACAR_TAG which would normally be passed in as %1 in batch script containing "TEST|DEV|PROD|QA|STRESS|[CLIENT SPECIFIC VALUE]"
Here is the output:
PS C:\dacar> .\startDacar.ps1
exe: -> c:\Program Files\Java\jdk1.5.0_22\jre\bin\java
opts: -> -server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxTe
nuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=TESTING -DprocType=ENGINE
jars: -> dist\lib\Dacar-Engine.jar;dist\lib\Dacar-Common.jar;dist\lib\Dacar-Collector.jar;dist\lib\standalone-Dacar.jar;dist\lib\DACAR-CRG.jar;;jars\activation.jar;jars
\commons-beanutils-1.6.jar;jars\commons-codec-1.3.jar;jars\commons-collections-3.2.jar;jars\commons-configuration-1.4.jar;jars\commons-dbcp-1.4.jar;jars\commons-digester
-1.6.jar;jars\commons-discovery-0.4.jar;jars\commons-id.jar;jars\commons-lang-2.2.jar;jars\commons-logging-1.0.3.jar;jars\commons-pool-1.5.4.jar;jars\concurrent.jar;jars
\graphics.jar;jars\ha-javamail-1.0-beta-1.jar;jars\hsqldb.jar;jars\ibatis-core-3.0.jar;jars\jcommon-1.0.6.jar;jars\jconn3.jar;jars\jdom.jar;jars\jetty-6.1.15.jar;jars\je
tty-util-6.1.15.jar;jars\jfreechart-1.0.3.jar;jars\jgroups-all.jar;jars\jmxri.jar;jars\jta.jar;jars\junit.jar;jars\log4j-1.2.9.jar;jars\mailapi.jar;jars\postgresql-8.0.3
09.jdbc2ee.jar;jars\postgresql-8.4-701.jdbc3.jar;jars\quartz-1.6.0.jar;jars\servlet-api-2.5-20081211.jar;jars\smtp.jar;jars\svnant.jar;jars\svnClientAdapter.jar;jars\svn
javahl.jar;jars\truezip-6.jar;jars\uic-optional.jar;jars\uic.jar
class: -> com.sungard.sims.dacar.standalone.Dacar
Unrecognized option: -server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepG
-XX:MaxTenuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=TESTING -DprocType=ENGINE
Could not create the Java virtual machine.
Adding the tag will be my next question if I can't figure this out.
JUST AS AN FYI, from with in a ps1 script I can start it the program with the following command successfully:
& "c:\Program Files\Java\jdk1.6.0_20\jre\bin\java" -server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxTenuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=TESTING -DprocType=ENGINE -classpath ".\configuration;dist\lib\Dacar-Engine.jar;dist\lib\Dacar-Common.jar;dist\lib\Dacar-Collector.jar;dist\lib\standalone-Dacar.jar;dist\lib\DACAR-CRG.jar;;jars\activation.jar;jars\commons-beanutils-1.6.jar;jars\commons-codec-1.3.jar;jars\commons-collections-3.2.jar;jars\commons-configuration-1.4.jar;jars\commons-dbcp-1.4.jar;jars\commons-digester-1.6.jar;jars\commons-discovery-0.4.jar;jars\commons-id.jar;jars\commons-lang-2.2.jar;jars\commons-logging-1.0.3.jar;jars\commons-pool-1.5.4.jar;jars\concurrent.jar;jars\graphics.jar;jars\ha-javamail-1.0-beta-1.jar;jars\hsqldb.jar;jars\ibatis-core-3.0.jar;jars\jcommon-1.0.6.jar;jars\jconn3.jar;jars\jdom.jar;jars\jetty-6.1.15.jar;jars\jetty-util-6.1.15.jar;jars\jfreechart-1.0.3.jar;jars\jgroups-all.jar;jars\jmxri.jar;jars\jta.jar;jars\junit.jar;jars\log4j-1.2.9.jar;jars\mailapi.jar;jars\postgresql-8.0.309.jdbc2ee.jar;jars\postgresql-8.4-701.jdbc3.jar;jars\quartz-1.6.0.jar;jars\servlet-api-2.5-20081211.jar;jars\smtp.jar;jars\svnant.jar;jars\svnClientAdapter.jar;jars\svnjavahl.jar;jars\truezip-6.jar;jars\uic-optional.jar;jars\uic.jar" com.sungard.sims.dacar.standalone.Dacar
But that is not really an option, as That is just invoking the thing in a hard coded fashion.
One thing to note about PowerShell variable expansion is that if it's anything more than a simple $VARIABLE expression you typically need to escape it using curly braces or a sub-expression.
So this line:
$JAVA_EXE="$ENV:JDK15\jre\bin\java"
Could be represented as either:
$JAVA_EXE="${ENV:JDK15}\jre\bin\java"
or...
$JAVA_EXE="$($ENV:JDK15)\jre\bin\java"
EDIT: Apparently PowerShell does
correctly evaluate all 3 examples. I
seem to recall the first syntax not
working but perhaps that was in
PowerShell 1.0 or a CTP...
Another useful tip that I often suggest people do when working with external .exe commands is to map it to an alias using the Set-Alias command. This way it makes working with the command a lot more natural as you don't have to use the &"string" syntax.
Set-Alias java "$($ENV:JDK15)\jre\bin\java.exe"
java blah1 blah2 etc