Windows 7 Grails installation - java

I am working with Groovy & Grails for the first time and having trouble getting the local Windows 7 environment to accept the correct locations of the paths to the bin. Well at least I think after following the www.grails.org\Installation.
Here is what the prompt feedback is showing:
C:\Groovy Grails\grails-1.3.7>gradlew
ERROR: JAVA_HOME might be set to an invalid directory: C:\Program Files\Java\jdk
1.7.0_03\bin;
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation if there are problems.
The system cannot find the path specified.
Any suggestions to get going in grails?

take off the /bin, just use: C:\Program Files\Java\jdk 1.7.0_03
never tried to build grails. here what happened:
R:\dev\grails-2.0.1>gradlew --stacktrace
FAILURE: Build failed with an exception.
* Where:
Script 'R:\dev\grails-2.0.1\gradle\assemble.gradle' line: 56
* What went wrong:
A problem occurred evaluating script.
Cause: Could not find property 'org' on root project 'grails-2.0.1'.
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating script.
at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl
.run(DefaultScriptRunnerFactory.java:51)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.
apply(DefaultScriptPluginFactory.java:127)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.appl
yScript(DefaultObjectConfigurationAction.java:82)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.acce
ss$000(DefaultObjectConfigurationAction.java:32)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$1.ru
n(DefaultObjectConfigurationAction.java:54)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.exec
ute(DefaultObjectConfigurationAction.java:114)
at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject
.java:847)
at org.gradle.api.Project$apply$0.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.gro
ovy:31)
at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
at build_7hj6n9uur9rg08bs08d0m02icl.run(R:\dev\grails-2.0.1\build.gradle
:245)
at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl
.run(DefaultScriptRunnerFactory.java:49)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.
apply(DefaultScriptPluginFactory.java:127)
at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptPro
cessor.java:38)
at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProj
ectEvaluator.java:38)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:487)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProj
ect.java:71)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectE
valuationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectE
valuationConfigurer.java:21)
at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuil
dConfigurer.java:38)
at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuil
dConfigurer.java:35)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractPro
ject.java:463)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractP
roject.java:458)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuil
dConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:141)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:112)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:80)
at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:41)
at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:27)
at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReporti
ngAction.java:32)
at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReporti
ngAction.java:21)
at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execut
e(CommandLineActionFactory.java:219)
at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execut
e(CommandLineActionFactory.java:203)
at org.gradle.launcher.Main.execute(Main.java:55)
at org.gradle.launcher.Main.main(Main.java:40)
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:
46)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:28)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja
va:33)
at org.gradle.wrapper.Wrapper.execute(Wrapper.java:87)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:37)
Caused by: groovy.lang.MissingPropertyException: Could not find property 'org' o
n root project 'grails-2.0.1'.
at org.gradle.api.internal.AbstractDynamicObject.propertyMissingExceptio
n(AbstractDynamicObject.java:43)
at org.gradle.api.internal.AbstractDynamicObject.getProperty(AbstractDyn
amicObject.java:35)
at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeD
ynamicObject.java:54)
at org.gradle.api.internal.project.DefaultProject_Decorated.getProperty(
Unknown Source)
at org.gradle.groovy.scripts.BasicScript.propertyMissing(BasicScript.gro
ovy:59)
at assemble_2be0amk65dsfi1le6c3b1ao87h.run(R:\dev\grails-2.0.1\gradle\as
semble.gradle:56)
at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl
.run(DefaultScriptRunnerFactory.java:49)
... 40 more
BUILD FAILED
Total time: 3.287 secs
R:\dev\grails-2.0.1>

I'm running Grails on a Windows 7 machine and had no problems. My environment variables look like this:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_25
GRAILS_HOME=C:\grails-1.3.8
No problems getting it to run. But it runs horribly slowly, which it did not do on my xp machine.

Try setting your JAVA_HOME to something like "C:\Program Files\Java\jre7" i.e.to the jre folder instead of JDK folder inside Java directory.(Refer this SO post) This worked for me.

You might be adding quotes to the RC file.
This is the contents of my %USERPROFILE%\\.groovy\preinit.bat:
set GROOVY_HOME=C:\Path\To\Groovy<br/>
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_92

Related

Module not found error for nodejavabridge_bindings.node when executing jest test although file exists on specified directory

I am using NCache NodeJS client package and writing tests by calling NCache API's. Package has dependency of Java. After I installed and used that package to write simple test. Test execution failed with module not Found error:
Error Message
Messgae:
The specified module could not be found.
\\D:\GitHome\Test\node_modules\java\build\Release\nodejavabridge_bindings.node
at Runtime._loadModule (node_modules/jest-runtime/build/index.js:893:29)
at Object.<anonymous> (node_modules/java/lib/nodeJavaBridge.js:21:16)
File in above mentioned directory exits.
Note: When I used that package in simple index.js file it worked fine as expected but unable to run with jest.
No major configuration done for jest in package.json file.
Java jdk-11.0.6 installed on box and JAVA_HOME is set.
Package.json
test.specs.js
Unable to identify the exact reason of failure therefore stuck on how to resolve it.
Environment:
OS: Windows
node: 14.15.3
jest: 26.6.3
C:\Program Files\OpenJDK\jdk-16.0.1\bin\server needs to be in your path. On windows can Edit the system environment > Environment Variables... > System variables and add C:\Program Files\OpenJDK\jdk-16.0.1\bin\server
Other option is to add it to your test runner. For example in WebStorm edit the Run Configurations and add Environment variables PATH=C:\Program Files\OpenJDK\jdk-16.0.1\bin\server

Classpath issues - getJNIEnv failed

I have successfully compiled the JNI based Apache libhdfs (C++) on my Hadoop Sandbox / CentOS - no compilation errors or warnings:
g++ test.cpp -o test -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151.x86_64/include/
-I/usr/hdp/2.6.3.0-235/usr/include/ -I/usr/hdp/2.6.3.0-235/hadoop/bin
-I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el6_9.x86_64/include/
-I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el6_9.x86_64/jre/lib/amd64/
-L/usr/hdp/2.6.3.0-235/hadoop/lib/ -L/usr/hdp/2.6.3.0-235/hadoop/lib/native
-L/usr/hdp/2.6.3.0-235/hadoop/lib/ -L/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el6_9.x86_64/jre/lib/amd64/
-L/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el6_9.x86_64/jre/lib/amd64/server/
-lhdfs -pthread -ljvm
Once I try to run the code, I get the following errors:
[root#sandbox-hdp ~]# ./test
Environment variable CLASSPATH not set!
getJNIEnv: getGlobalJNIEnv failed
Environment variable CLASSPATH not set!
getJNIEnv: getGlobalJNIEnv failed
If I run hadoop classpath in the terminal, I get the following output:
[root#sandbox-hdp ~]# hadoop classpath
/usr/hdp/2.6.3.0-235/hadoop/conf:/usr/hdp/2.6.3.0-
235/hadoop/lib/:/usr/hdp/2.6.3.0-235/hadoop/.//:/usr/hdp/2.6.3.0-235/hadoop-
hdfs/./:/usr/hdp/2.6.3.0-235/hadoop-hdfs/lib/:/usr/hdp/2.6.3.0-235/hadoop-
hdfs/.//:/usr/hdp/2.6.3.0-235/hadoop-yarn/lib/:/usr/hdp/2.6.3.0-235/hadoop-
yarn/.//:/usr/hdp/2.6.3.0-235/hadoop-mapreduce/lib/:/usr/hdp/2.6.3.0-
235/hadoop-mapreduce/.//::jdbc-mysql.jar:mysql-connector-java-
5.1.17.jar:mysql-connector-java-5.1.37.jar:mysql-connector-
java.jar:/usr/hdp/2.6.3.0-235/tez/:/usr/hdp/2.6.3.0-
235/tez/lib/:/usr/hdp/2.6.3.0-235/tez/conf
On the Apache libhdfs page it says:
The most common problem is the CLASSPATH is not set properly when
calling a program that uses libhdfs. Make sure you set it to all the
Hadoop jars needed to run Hadoop itself as well as the right
configuration directory containing hdfs-site.xml. It is not valid to
use wildcard syntax for specifying multiple jars. It may be useful to
run hadoop classpath --glob or hadoop classpath --jar to generate the
correct classpath for your deployment. See Hadoop Commands Reference
for more information on this command.
I do however not get how to proceed after many trial and error attempts, I would therefore appreciate any help that could help me to solve this problem.
Edit: tried the following: CLASSPATH=hadoop classpath ./test
...which gave me the following error: libjvm.so: cannot open shared object file: No such file or directory
I tried the following: export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el6_9.x86_64/jre/lib/amd64/server
...and now the error is:
[root#sandbox-hdp ~]# CLASSPATH=$CLASSPATH:`hadoop classpath` ./test
loadFileSystems error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
hdfsBuilderConnect(forceNewInstance=0, nn=default, port=0, kerbTicketCachePath=(NULL), userName=(NULL)) error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
hdfsOpenFile(/tmp/testfile.txt): constructNewObjectOfPath error:
(unable to get stack trace for java.lang.NoClassDefFoundError exception: ExceptionUtils::getStackTrace error.)
Maybe the following could works for you:
CLASSPATH=$CLASSPATH:`hadoop classpath` ./test
or only this:
CLASSPATH=`hadoop classpath` ./test
Check out JAVA_HOME environment variable, maybe it could alter the java libraries used too.
And finally, a wrapper like the script below could be useful:
#!/bin/bash
export CLASSPATH="AllTheJARs"
ARG0="$0"
EXEC_PATH="$( dirname "$ARG0" )"
"${EXEC_PATH}/test" $#

Cordova Could not reserve enough space for 2097152KB object heap

I am new to cordova and am trying to create an android HelloWold project.
When I use cordova platforms add android, it throws some exception:
D:\CordovaSpace\helloWorld>cordova platforms add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.example.helloworld
Name: HelloWorld
Activity: MainActivity
Android target: android-24
Subproject Path: CordovaLib
Android project created with cordova-android#6.0.0
Installing "cordova-plugin-whitelist" for android
ANDROID_HOME=D:\Java_Android_SDK\android_sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_73
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Failed to install 'cordova-plugin-whitelist':Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (D:\CordovaSpace\helloWorld\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:850:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
Error: cmd: Command failed with exit code 1
Try again after increasing your Java VM(?) memory size.
Here is how to fix it on a Windows platform:
Go to Start -> Control Panel -> System -> Advanced(tab) -> Environment Variables -> System Variables -> New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Don't ignore the score and underscore characters.
I had the exact same problem. I switched to use 64-bit JDK as suggested in here and it worked fine. I was using Ionic 3.5.0 on Windows 10.
this worked for my ionic app.
Change line on
// to allow dex in process
'org.gradle.jvmargs': '-Xmx1024m',
from
// to allow dex in process
'org.gradle.jvmargs': '-Xmx2048m',
in your
<app path>\platforms\android\cordova\lib\config
thanks
args.push('-Dorg.gradle.jvmargs=-Xmx2048m')
into
args.push('-Dorg.gradle.jvmargs=-Xmx1024m');
on the following location files.
project-folder\platforms\android\cordova\lib\builders\GradleBuilder.js
project-folder\platforms\android\cordova\lib\builders\StudioBuilder.js
Go to : \platforms\android\cordova\lib\config\GradlePropertiesParser.js
constructor (platformDir) {
this._defaults = {
// 10 seconds -> 6 seconds
'org.gradle.daemon': 'true',
// to allow dex in process
'org.gradle.jvmargs': '-Xmx2048m',
// allow NDK to be used - required by Gradle 1.5 plugin
'android.useDeprecatedNdk': 'true'
// Shaves another 100ms, but produces a "try at own risk" warning. Not worth it (yet):
// 'org.gradle.parallel': 'true'
};
And change the 'org.gradle.jvmargs': '-Xmx2048m', to 'org.gradle.jvmargs': '-Xmx1024m',
args.push('-Dorg.gradle.jvmargs=-Xmx2048m')
to
args.push('-Dorg.gradle.jvmargs=-Xmx1024m');
on the following location files.
project-folder\platforms\android\cordova\lib\builders\builders.js
project-folder\platforms\android\cordova\lib\builders\GradleBuilder.js
project-folder\platforms\android\cordova\lib\builders\StudioBuilder.js
Go to Start -> Control Panel -> System -> Advanced(tab) -> Environment Variables -> System Variables
Add/change JAVA_HOME value
from C:\Program Files (x86)\Java\jdk1.8.0_192
to C:\Program Files\Java\jdk1.8.0_192
That is, change from Program Files (x86) path to Program Files path.
I had a same problem.
Anyway, here is how to fix it:
Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
if 512 not work then change it to.
Variable value: -Xmx1024M
And also change the path.
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.
Setting the environment variable at system level as in the #kemal's solution will set the memory size for all the JVM applications in the system, which is not a what most would want to do.
Instead, set the heap size in your cordova gradlebuilder property file.
args.push('-Dorg.gradle.jvmargs=-Xmx2048m');

Java home path differs

Hello I try to execute my project with bootRun on IntelliJ and I get the followign error:
Execution failed for task ':bootRun'.
> Process 'command '/usr/lib/jvm/java-1.8.0-openjdk- 1.8.0.101-1.b14.fc24.x86_64/bin/java'' finished with non-zero exit value 1
I checked the results of my JAVA paths and stuff and here there are
echo $JAVA_HOME
/home/mypc123/Downloads/jdk1.8.0_101/bin/java
$ which java
/usr/bin/java
I have jdk1.8.0 in /usr/bin
I looked more indepth and found this:
ERROR org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool.
org.postgresql.util.PSQLException: FATAL: role "syn12" does not exist
However when I connect to postgresql I have syn12 role and all my gradle JVM's are in the form usr/lib/jvm/java.......
Well we got down to this : Can't load library: /opt/symmetry/ste/java/libste-java.so ,how can I install this library?
Seems like you have your project JDK pointed to another installation. The second issue is most likely different, like an incorrect JDBC url that happens to point to another, existing, database schema in which the required role does not exist.
Intellij IDEA doesn't use the $JAVA_HOME from your system but relies on its own JDK definitions.
It looks like your application is not starting because of the SQL error you found in the logs, and Spring Boot returns 1 because it failed to start.

Upgraded Fedora 24, Gradle status text does not show

Prior to upgrading to Fedora 24, I would see output from Gradle like the following:
> Loading
> Configuring project 0/20
> Executing test 39 of 4049, 12 skipped.
I've read that users often set TERM=dumb in order to disable this output; however, my TERM environment variable is set to xterm-256color.
Could someone tell me what I need to set or change under Fedora 24 (which seemed to exist in Fedora 23) to allow me to get this Gradle output?
The problem is that Gradle is wanting to use ncurses5 where it seems Fedora 24 install comes with a newer version, thus causing the issue. This can be seen by running gradle --debug and seeing the following output:
[DEBUG] [org.gradle.internal.nativeintegration.services.NativeServices] Unable to load from native-platform backed Consol
eDetector. Continuing with fallback. Failure: net.rubygrapefruit.platform.NativeException: Failed to load native library 'libnative-pl
atform-curses.so' for Linux amd64.
caused by: java.lang.UnsatisfiedLinkError: /home/dkowis/.gradle/native/19/linux-amd64/libnative-platform-curses.so: libncurses.so.5: c
annot open shared object file: No such file or directory
The temporary solution is to create a symbolic link to the new libncurses.so.6 library as follows:
sudo ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5
After doing this, Gradle now outputs the build status text as it did previously.

Categories

Resources