I've just installed sbt on my Windows Vista machine, following the guide on github wiki, using a sbt.bat script containing
set SCRIPT_DIR=%~dp0
java -Dfile.encoding=UTF8 -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=256m -jar "%SCRIPT_DIR%sbt-launch.jar" %*
When I run sbt in an empty directory, I get
L:\foo>sbt
L:\foo>set SCRIPT_DIR=L:\lib\sbt\
L:\foo>java -Dfile.encoding=UTF8 -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=256m -jar "L:\lib\sbt\sbt-launch.jar"
[info] Set current project to default-058262 (in build file:/L:/foo/)
>
instead of expected prompt to create a new project. What am I doing wrong?
In contrast with SBT 0.7, SBT 0.10+ does not prompt you for project creation, but assumes some default configuration and deploy its own working directories.
If you want to provide you settings, you must add an build.sbt file or a full configuration.
Add the np plugin. This replaces the previous functionality.
https://github.com/softprops/np
Related
How can I pass this params to gradle command
e.g.
./gradlew clean build org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
gives error as
* What went wrong:
Task 'org.gradle.jvmargs=-Xmx2048m' not found in root project
What you have written works if you put it in a gradle.properties file. If you want to use it on the command line, you first have to add a -D (see command line interface in the user guide) but also quote the argument as it contains spaces. E.g.
./gradlew clean build "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError" -Dfile.encoding=UTF-8
-Dorg.gradle.jvmargs="-Xmx8192M -Dkotlin.daemon.jvm.options\\=\"-Xmx8192M\""
works for me
I've got the following script to run:
# harvest_bug
#
start on runlevel [345]
script
java -jar /home/admin/es09AndroidUpdater/es09AndroidUpdater.jar
end script
But my linux machine doesn't know anything about java. If I run java -version, I will get
bash: java: command not found
I guess java is not in $PATH, because I still can run Tomcat and things like that. For example Tomcat's setenv.sh looks like that:
export JAVA_HOME=/usr/java/default
export JRE_HOME=/usr/java/default/jre
PATH=$PATH:$JRE_HOME/bin
export PATH
PATH=$PATH:$JAVA_HOME/bin
export PATH
export JAVA_OPTS="-Des09.config=/home/es09/es09.properties -Xms128m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m"
So how can I modify the script to run my jar? Can I do this?
# harvest_bug
#
start on runlevel [345]
script
export JAVA_HOME=/usr/java/default
export JRE_HOME=/usr/java/default/jre
PATH=$PATH:$JRE_HOME/bin
export PATH
PATH=$PATH:$JAVA_HOME/bin
export PATH
export JAVA_OPTS="-Des09.config=/home/es09/es09.properties -Xms128m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m"
java -jar /home/admin/es09AndroidUpdater/es09AndroidUpdater.jar
end script
Is that ok? Will linux run this script? Sounds very stupid, because I'm not familiar with bash, linux and things like that.
The main purpose of setting java path in $PATH or $JAVA_HOME environment variable is to define the exact path of java executable.
To run your script, use
$JRE_HOME/bin/java $JAVA_OPTS -jar /home/admin/es09AndroidUpdater/es09AndroidUpdater.jar
I have this line of code in a project in eclipse & it's giving me error.
Invoker invoker = new DefaultInvoker();
invoker.setMavenHome(new File(System.getenv("MAVEN_HOME"))); //giving error
So I ran and its giving blank line as output
echo $MAVEN_HOME
However, I am able to run other maven projects through command prompt and through eclipse.
I have following question..
Q 1. what is the difference between the following two commands
whereis maven
maven: /etc/maven /usr/share/maven
& when I run
whereis mvn
mvn: /usr/bin/mvn /usr/bin/X11/mvn /usr/share/man/man1/mvn.1.gz
Q 2. what do I need to put in .bashrc... please tell me exactly...
this is my current content of .bashrc file
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
export JAVA_HOME
export PATH
EDIT
mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Thanks :)
Just to use in eclipse you can add this in Window -> Preferences -> Java -> Build Path -> Classpath Variables.
Just add new variable with name MAVEN_HOME.
But for executions you need to set in in Run/Debug configuration - probably that's what you need.
whereis maven
is about directory, and
whereis mvn
is about executable file.
For .bashrc:
MAVEN_HOME=/usr/share/maven
export MAVEN_HOME
Don't set the MAVEN_HOME in bashrc file but set it in the Environment tab of the launcher configuration of Eclipse.
The .bashrc file is for the bash environment
Basically invoker.setMavenHome(MAVEN_HOME); this needs the home directory where you have installed maven. If you need to find where is the home directory of maven. You can you use following approaches as you tried.
whereis maven
This will be showing where is the location which maven has been installed into your computer.
maven: /etc/maven /usr/share/maven
What would be a solution to rebooting a java application with linux instead of using
"sh run.sh"
in terminal whenever I want to reboot it? The run.sh contains this:
java -Xmx1024m -Xss2m -Dsun.java2d.noddraw=true -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+UseAdaptiveGCBoundary -XX:MaxGCPauseMillis=500 -XX:SurvivorRatio=16 -XX:+UseParallelGC -classpath bin:data/libs/* com.runeown.Application
I want to restart it using terminal.
If you do not want to restart it using "sh run.sh" and instead you want to restart it using a command, you could use a bash alias to run the command.
here is the manual (http://www.ss64.com/bash/alias.html)
here is a relevant askubuntu thread about making a permanent alias (https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias)
An alias is essentially a shortcut for the terminal, for instance you had a dropbox folder located at ~/myfiles/1/2/dropbox and you did not want to type cd + path every time, you could make an alias:
alias cddropbox="cd ~/myfiles/1/2/dropbox"
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 .