Intellij cant build JVM - intellij-idea

I can run java from command line, but when trying to run with Intellij I get this error msg.
Error:Abnormal build process termination:
Picked up _JAVA_OPTIONS: "-Xmx6144m"
Invalid maximum heap size: -Xmx6144m
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.
Why is -Xmx6144m invalid?
It works fine in command line...
$>javac -version
Picked up _JAVA_OPTIONS: "-Xmx6144m"
javac 1.8.0_71

The JDK configured for your project in IntelliJ IDEA is different from the one that is specified by the JAVA_HOME environment variable in your shell. You can open the Project Structure dialog and select the correct JDK for your project. (To use -Xmx6144m, it needs to be a 64-bit JDK.)

Related

Liquibase Installation Troubleshooting

Liquibase was install in the following location
C:\liquibase
when I run the following command on cmd,
liquibase
I get error
the system can not find specified path
I added liquibase to system variable
when I run the following command on cmd
java -version
The following output is displayed
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) Client VM (build 25.271-b09, mixed mode, sharing)
I also tried navigating to C:\liquibase and ran
liquibase --help
and the output was
the system can not find specified path
Any suggestion on what should be adjusted to run liquibase?
After deleting JAVA_HOME variable that was set on user variables, the issue was fixed. See the following image that shows the user and system evironment variables, the user variable that was deleted is indicated surrounded by a red rectangle.
You need to add C:\liquibase to your Path variable in order for liquibase.bat file (which is located in C:\liquibase) to be accessible from any location.

Payara does not start from Intellij

The Payara with GlassFish 5.192.0 does not start using the Intellij Idea.
If I run payara\bin\asadmin start-domain is works just fine, and the server starts and runs.
These are the final lines from the console output with the --verbose property set on true.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
Command start-domain failed.
The DAS was stopped.
The root case of the issue is logged here.
Windows launcher prepends PATH with JetBrains Runtime bin directory in order to load certain DLLs without issues. It turned out to be not the best solution and we are working to address it in a different way.
asadmin.bat uses the first java.exe from PATH. It doesn't try to detect it via JAVA_HOME.
The workaround for now is to switch IntelliJ IDEA boot JDK to JBR8 per this document or start IntelliJ IDEA using idea.bat instead of idea64.exe.
The issue is fixed in 2019.2.1 RC.

jackrabbit - There is an error in invoking javac. A full JDK (not just JRE) is required

I'm learning Jackrabbit and following the documentation to run a standalone server. When I run the command java -jar jackrabbit-standalone-2.16.2.jar and access localhost:8080 on my browser, I get a 500 error saying:
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
What am I doing wrong?
Note: I have set my jdk/bin path in my environment variables.Also, my javac command is working properly. I've jdk version 1.8.0_74 and Jackrabbit version 2.16.2
Edit: According to this answer, I tried setting my jdk to my installed jres in eclipse but that didn't solve my problem.
Running the latest jackarabit standalone jar(2.17.3) in my machine(windows 10 and java home pointing in java8 jdk) produced the same errors.
I then executed the rar with java -Djava.home="%JAVA_HOME%" -jar jackrabbit-standalone-2.17.3.jar. Although I got the same error in browser I was able to see errors in the console where I invoked the running command.
One of these error was
can't open C:\Progra~1\Java\jdk1.8.0_144\lib\tzmappings.
Searching my java installation I found that the missing files, are located under jre's installation folder.
So I eventually made the standalone jar to work with:
java -Djava.home="%JAVA_HOME%\jre" -jar jackrabbit-standalone-2.17.3.jar
The initial error is a bit misleading as it refers to javac and not to the missing files.
The whole thing seems to be a bug for me. Please give a try to my workaround and if it works for you consider filing a bug in Jackrabbit's issue tracker platform.
jackrabbit-standalone uses JSP. JSP needs compilation. Compilation needs JDK.
Before running java -jar jackrabbit-standalone-2.16.2.jar do you check your JAVA_HOME, and make sure it refers to a fully-fledged JDK? In short, the bin directory should have javac.
I found that there was another variable in the Path environment System variable preceding my %JAVA_HOME%\bin variable.
You don't have to delete the other variable, but move it down (or move %JAVA_HOME\bin up) to correct the load order.

Error initializing JVM

I am getting "Could not reserve enough space for object heap" error when I am trying to start hybris server.
I have set
wrapper.java.additional.1=-Xmx1G
wrapper.java.additional.2=-XX:MaxPermSize=1024M
My machine is 64 bit 8GB RAM Windows
I faced the same problem once, The problem in my case was that too many other Applications were running on my system.
So go to the task manager and check the memory available use.
Close some applications and try running.
Also if you are using eclipse Then, In your eclipse.ini file (this is beside the eclipse executable), replace -Xmx256m with -Xmx1024m (or Xmx512m).
This is not compulsory but in certain cases it works.
If you are using some extension then,
Open YOURPATH/config/local.properties file.
Add the following entry:
config/local.properties
build.parallel=true
Save the file.
(In cases where we have multiple cores in the machine, we can tell hybris to utilize these by building in parallel and in certain cases this too works)
I too faced the same probelm. I followed below steps and set the max heap size to 1GB.
Add the following content to local.properties
tomcat.generaloptions=-Xmx4G -ea -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dorg.tanukisoftware.wrapper.WrapperManager.mbean=true -Djava.endorsed.dirs="%CATALINA_HOME%/lib/endorsed" -Dcatalina.base=%CATALINA_BASE% -Dcatalina.home=%CATALINA_HOME% -Dfile.encoding=UTF-8 -Dlog4j.configuration=log4j_init_tomcat.properties -Djava.util.logging.config.file=jdk_logging.properties -Djava.io.tmpdir="${HYBRIS_TEMP_DIR}"
ant clean all
start hybrisserver
Reference
https://launchpad.support.sap.com/#/notes/0002437669

Running tests in IntelliJ: cannot create JVM

I am running IntelliJ version 13.1.3, on a 32 bit windows machine.
The JVM version is 1.7.
When running even simple tests, the following error is thrown:
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Process finished with exit code 1
Can anyone assist?
Thanks
Pycharm that stands on the intellij has the jvm configuration file with this name:
pycharm.exe.vmoptions
Maybe you can find similar file in the binary path of intellij to change the jvm heap properties.
Comment from Engineer Dollery is correct. I found this in my POM file. I just commented out and the then I was able to run the test.
<!--<argLine>-Xms128m -Xmx4096m -XX:MaxPermSize=128m</argLine>-->
Go to file.
Select Project Structure.
Choose Project Settings then Select Project
There You can see Project language level
Just put it back to 8.
Project language level is changed in new update of InteliJ update thats why This error Occurs
Now just try to run your Code.