Is there a way to set -Xmx when i start the application with "./activator start"
I tried (not working):
./activator start -J-Xmx2g
./activator -mem 2048 start
_JAVA_OPTIONS="-Xmx2g" ./activator start
It says
"Picked up _JAVA_OPTIONS: -Xmx2g"
but still not working.
Also tried various values in build.sbt and application.conf - no luck
The only way i could make it work was to use
"stage" and pass -Xmx2g to the generated shell script, which is fine, but it doesn't detach the console.
I think I tried all I found on google but still no luck.
I would like to pass -Xmx to the activator start somehow.
First define an environment variable with your JVM parameters named _JAVA_OPTIONS
export _JAVA_OPTIONS="-Xmx2048m"
and then try the play start or use the activator.
I have found solution. There is some bug in activator shell script, so passing -J-Xmx argument does not remove default mem options. To change mem parameter have a look at your activator script (/usr/local/bin/activator) and have a look how mem parameters are added. Also notice that passing -v argument will print final command to lunch java. Working solution on linux for me is this:
export JAVA_OPTS="-Xmx2700m";activator -v
# Executing command line:
java
-Dactivator.home=/usr/local/bin
-Xmx2700m
-jar
/usr/local/bin/activator-launch-1.3.2.jar
Examples of not working solution:
_JAVA_OPTIONS="-Xmx2048m";activator -J-Xmx2700m -J-Xms1024m -v
# Executing command line:
java
-Dactivator.home=/usr/local/bin
-Xmx2700m
-Xmx2700m
-Xms1024m
-jar
/usr/local/bin/activator-launch-1.3.2.jar
Also not working:
activator -J-Xmx2700m -J-Xms1024m -v
# Executing command line:
java
-Dactivator.home=/usr/local/bin
-Xmx2700m
-Xmx2700m
-Xms1024m
-jar
/usr/local/bin/activator-launch-1.3.2.jar
I think you need to specify both, min and max heap size, try this:
activator -J-Xmx2048m -J-Xms2048m start
Related
When running JMeter, java server has the -Xmx value of only 512 MB. I tried to change it via following code in the jmeter.bat.sh file.
set HEAP=-server -Xms512m -Xmx6144m
set NEW=-XX:NewSize=512m -XX:MaxNewSize=6144m
also tried this:
set HEAP= -Xms512m -Xmx6144m
set NEW=-XX:NewSize=512m -XX:MaxNewSize=6144m
By checking the process after while JMeter is running I can see that java -sever doesn't recognize this setting.
If you are running jmeter startup script on Linux the syntax will be different, i.e:
HEAP="-Xms512m -Xmx6G"
as SET command is something Windows-specific
Alternatively you can define JVM_ARGS environment variable value like:
JVM_ARGS="-server -Xms512m -Xmx6G" && export JVM_ARGS
this way you won't need to edit files and/or restart JMeter.
Finally, you can launch JMeter jar directly like:
java -server -Xms512m -Xmx6G -jar ApacheJMeter.jar
See the following reference material:
Tuning Java Virtual Machines (JVMs)
JMeter Best Practices
9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure
I am trying to using Doop framework. I am following this link: https://bitbucket.org/yanniss/doop
I downloaded the code and compiled it successfully. but when I am trying to Running Doop by the following command
$ DOOP_HOME>./bin/doop -a context-insensitive -j ./lib/asm-debug-all-4.1.jar
in my case, it is :
./doop -a context-insensitive -j ../lib/asm-debug-all-5.0.3.jar
But, unfortunately, I got an error.
vuquangvinh#vuquangvinh-VPCEA24FM:~/tutorial/DoopFramework/code/doop/bin$ ./doop -a context-insensitive -j ../lib/asm-debug-all-5.0.3.jar
:: loading settings :: url = jar:file:/home/vuquangvinh/tutorial/DoopFramework/code/doop/lib/ivy-2.3.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
The EXTERNALS directory is invalid: null
I have no idea what is happening. I have tried, but this framework seems to be not popular. Anyone can help me!
Many thanks!
As stated in the documentation the tool expects several environment variables DOOP_HOME, DOOP_OUT, DOOP_HOME and DOOP_EXTERNALS to be set and it simply complains that DOOP_EXTERNALS is not set.
Instead of setting the environment variable you can also pass the externals directory via command line option --externals <the directory>.
I have a Play Framework application that I want to run on production mode but whenever I run activator start -mem 512 or activator start -J-Xms512m -J-Xmx512m I get errors about JVM not being able to allocate enough memory. The odd thing is that error logs indicate that arguments passed on to jvm was:
-Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m -Duser.dir=/home/oguz/dev/rhymo-server/target/universal/s$
but when I print the command information from the activator bash script I get:
java -Dactivator.home=/home/oguz/frameworks/activator-1.2.12 -Xms512m -Xmx512m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=256m -jar /home/oguz/frameworks/activator-1.2.12/activator-launch-1.2.12.jar start
It seems that play is running the right command but somewhere along the lines the arguments get discarded. What is wrong here? Am I forgetting something?
I think that you are facing a bug in Activator. You can work around it using JAVA_OPTS:
$ JAVA_OPTS="-Xms512m -Xmx512m -XX:MetaspaceSize=64m" ./activator start
or add an alias to this to your .bashrc/.zshrc. Also you can run activator stage and then start your app using
$ target/universal/stage/bin/YOUR-APP-NAME -mem 512
I am running the java program on windows server 2012, I want to set the JAVA_OPTS variable and use it, here is how I am doing it:
Open a command prompt in the bin of jdk where it is installed ,and executing the following command :
$set JAVA_OPTS = “-Xdebug , server=y”
Then in the next line in the command prompt only , when I try to run
$java $JAVA_OPTS –cp .Server
(where Server is the name of the java program), I get an error saying that:
Could not find or load assembly $JAVA_OPTS. Please let me know what mistake I am doing here. I am not using IDE for this purpose.
on windows you have to set the variable like:
set JAVA_OPTS = “-Xdebug , server=y”
and use it this way
java %JAVA_OPTS% –cp .Server
Windows uses "%JAVA_OPTS% rather than "$JAVA_OPTS" which is UNIX/LINUX.
You can check if the environment is updated with JAVA_OPTS by echoing that:
echo %JAVA_OPTS%.
I've searched throughout this site and tried a few solutions when receiving this message but nothing seems to work.
I am trying to invoke a shell script on Ubuntu 12.04.2 (with java-7-openjdk-amd64) that runs a java program and then I get a "Error: Could not find or load main class com.xx" error.
This is how my script invokes Java:
"$JAVA" $server_jvmargs $javaProps -Dxx.home="$XX_HOME" -Duser.dir="$XX_HOME" -cp $client_classpath $mainclass $args
And the arguments you see above are defined as follows:
args=$*
javaProps=
mainclass=com.xx
server_jvmargs="-Djava.awt.headless=true -Xms1024m -Xmx1024m $jvmargs"
XX_HOME="`pwd`/../.."
client_classpath="$XX_HOME/lib/client/patch.jar;$XX_HOME/lib/client/xyx-xxx.jar;$clientlibs;$XX_HOME/lib/server/standard-1.1.2.jar;$publictilesource;$respath;$XX_HOME/lib/client/xxmainclass.jar"
The mainclass variable is in the classpath located in the xxmainclass.jar file so I'm not sure as to why it cannot find it?
Does anyone have any ideas on what could be going on?
To see what actually happens when you run your script, invoke it with bash -x, or put set -x at the top; this will print each command before it's run, so you can see how it's actually starting the JVM. Without this information, it's hard to come up with a better diagnosis. That said...
You've been copying off Tomcat's startup scripts, it looks like. Don't; they're awful.
Something a little more correct on the shell side might look like this:
args=( "$#" )
javaProps=( )
mainclass=com.xx
server_jvmargs=( -Djava.awt.headless=true -Xms1024m -Xmx1024m "${jvmargs[#]}" )
XX_HOME="$PWD/../.."
client_classpath="$XX_HOME/lib/client/patch.jar:$XX_HOME/lib/client/xyx-xxx.jar:$clientlibs:$XX_HOME/lib/server/standard-1.1.2.jar:$publictilesource:$respath:$XX_HOME/lib/client/xxmainclass.jar"
java \
"${server_jvmargs[#]}" \
"${javaProps[#]}" \
-Dxx.home="$XX_HOME" \
-Duser.dir="$XX_HOME" \
-cp "$client_classpath" \
"$mainclass" "${args[#]}"
The use of ${foo[#]} expands the array foo with literal contents. Note that foo must be created as an array in this case, and you need to be using a shell that supports arrays (so your script needs to start with #!/bin/bash, not #!/bin/sh).
See http://mywiki.wooledge.org/BashFAQ/005 for an introduction to arrays in bash.
use a : instead of a ; in your classpath.
unix just rolls that way.
Try this:
Java -jar pathToYOurFile.jar
Please check if line end character is OS specific in your shell script