"Picked up _JAVA_OPTIONS" when no such environment variable exists - java

This issue pertains specifically to Minecraft, but it is affecting all Java programs that run on my computer.
It would seem that something is forcibly setting a _JAVA_OPTIONS environment variable. When I run my server, I have specified to allocate 4 GB of RAM to it with
-Xms4G -Xmx4G
in the startup batch file. However, when the server runs, It prints "Picked up _JAVA_OPTIONS: -Xms2048M -Xmx2048M" to the console, only allocating 2 GB. I have checked my system settings and there is no _JAVA_OPTIONS environment variable in the list. I do not want to add one, since that will also try to allocate 4 GB to Minecraft itself, which is unnecessary and uses too much RAM.
What could be causing this variable to be set? (Windows 8.1 64-bit, Java 7)

You probably have a Razer device. Their god-forsaken software secretly adds _JAVA_OPTIONS, but only when launching games, so you won't even see it from CMD. Ideally uninstall the software, and maybe splash some holy water on your PC. Failing that, you can probably get by with shutting down Synapse and restarting minecraft.exe
Found (eventually) here: http://www.minecraftforum.net/forums/support/unmodified-minecraft-client/2183431-_java_options-picked-up-without-existing#reply

This error occurs actually when you run an android application after compiling a java program. Eclipse uses java's compiler to execute android application. So run your android application as an android application. Just right click on project and click on run as->android application instead of run configurations.

Related

solutions for Java JVM creation involving memory allocation do not fix my issue

I have a java virtual machine error on Windows 10. Nothing I have found (which is mostly gaming related) solve my Java failure to create the virtual machine. I have custom app add in for Enterprise Architect. The app to run is set as C:\Program Files (x86)\Java\jre1.8.0_161\bin\javaw.exe the arguments are set as -classpath edu.vanderbilt.isis.face.v21.datamodel.ea.importexport.gui.jar;C:\Users\mi\Documents\EA\EA_Java_Bindings" -Djava.library.path=C:\Users\mi\Documents\EA\EA_Java_Bindings edu.vanderbilt.isis.face.v21.datamodel.ea.importexport.gui.EAImportExport --ea-project-file "$f" --ea-package-guid $P -import
It has not made a difference what memory allocations I have tried to launch the VM
The application says it is a Java 7 application. I have tried uninstalling all java, and only installing java 7. and likewise for java 8 to try and get this app to launch with no success. I still have no success. Some I can see a second or so of execution, others absolutely nothing.

Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine

I am facing this problem since more than a month, here is what I see when I run java on command line:
$ java -Xmx1300m
Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.
If I run with less memory it works fine
$ java -Xmx1240m Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) ..... .....
I spent a week trying to debug this and nothing worked. Finally I had my IT support guys replace the laptop. This happened a month ago on 10/23. Now, after a month, the same problem is back on my new system.
My system configuration is:
Win 7 Enterprise (64-bit), Service Pack 1. Intel(R) Core(TM) i7-2640M
CPU # 2.80GHz 8.00 GB RAM
Java: java version "1.5.0_20" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02) Java HotSpot(TM) Client VM (build 1.5.0_20-b02, mixed mode)
We are a team of about 30 guys here and I am the only one facing this. All others have almost the same config and working fine for them.
An important observation is Java works fine for some time and then this problem appears once it appears it doesn't go away, even if I re-install java.
I faced this issue the 3rd time after the IT support guys re-imaged by laptop. It worked for a month and now the same problem is back.
Everybody is completely clueless. I have started using 2 laptops now. :-)
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
taken from this link
Eureka ! Finally I found a solution on this.
This is caused by Windows update that stops any 32-bit processes from consuming more than 1200 MB on a 64-bit machine. The only way you can repair this is by using the System Restore option on Win 7.
Start >> All Programs >> Accessories >> System Tools >> System Restore.
And then restore to a date on which your Java worked fine. This worked for me. What is surprising here is Windows still pushes system updates under the name of "Critical Updates" even when you disable all windows updates. ^&%)#* Windows :-)
This might also occur if you are running on 64-bit Machine with 32-bit JVM (JDK), switch it to 64-bit JVM. Check your (Right Click on My Computer --> Properties) Control Panel\System and Security\System --> Advanced System Settings -->Advanced Tab--> Environment Variables --> JAVA_HOME...
Thanks.I changed heap space from 2000MB to 1024MB and it worked...
I've just seen this problem myself, Jboss AS7 with jdk1.5.0_09. Update System Property JAVA_HOME to jdk1.7+ to fix (I'm using jdk1.7.0_67).
If your computer is a 64bit, all you need to do is uninstall your Java x86 version and install a 64bit version. I had the same problem and this worked. Nothing further needs to be done.
you can do update the User path as inside
_JAVA_OPTIONS : -Xmx512M
Path : C:\Program Files (x86)\Java\jdk1.8.0_231\bin;C:\Program Files(x86)\Java\jdk1.8.0_231\jre\bin
for now it is working /
/
Sometimes it may happen that you run multiple applications on the same java VM. In Case you have tried all the other solutions described above and it didnt work. Try Running your process by running it on a newly created java VM by passing vmargs
-agentlib:jdwp=transport=dt_socket,server=y,address=10049,suspend=n .
Here address is what the vm takes.

Eclipse intermittently fails to create the Java Virtual Machine

I am using Windows 7 32-bit OS. I am using Eclipse 3.7 (Indigo) 32 bit. I have jdk1.7.0_07 32-bit installed. And sometimes when I go to run Eclipse as administrator, I get the following error message,
And when I tap "OK", I get the following error message,
And sometimes I get this error message. And at other times, Eclipse will launch, but fail when Gradle goes to initialize its VM when attempting to start its daemon process.
What's happening? I realize it's a memory issue, but why am I able to launch Eclipse once in a while and run everything just fine? And at other times, why I am able to launch Eclipse but not able to run anything, or unable to launch Eclipse at all?
As a developer, this behavior is a nuisance.
Try -Xmx900m. The problem might be with the eclipse.ini file.
I've had this problem with JDK7. I've found that i do better with eclipse if it runs under Java 6, and then you add JDK7 as the runtime environment for your project.
Make sure that your eclipse matches your jre/jdk bitwise. If you are using 32-bit eclipse, you must use 32-bit jdk.
Your -vm param is wrong. The arg must start on the next line like this:
-vm
c:\Program Files\java... etc
When the JVM (Sun's JVM) starts it allocates the heap as a single malloc, a single contiguous block of memory. If, for any reason, that much contiguous memory is not available then the JVM will not start. Without debugging your machine is hard to know what could be blocking a big malloc. Note that some viruses recently have been taking shelter inside the jvm.
you said that your's is a 32 bit os is you your eclipse is 32 bit compatable or 64 bit if it is 64 bit remove the java related folder in your eclipse and replace it with 64 bith java sdk this will work i got this problem and i got it solved in this way.

“Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G

First of all, I have a box with 8gb of ram, so I doubt total memory is the issue.
This application is running fine on machines with 6gb or less.
I am trying to reserve 3GB of space using -Xmx3G under "VM Arguments" in Run Configurations in Eclipse.
Every time I try to reserve more than 1500mb, I get this error:
“Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
What is going on here?
Could it be that you're using a 32-bit jvm on that machine?
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
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.
This is actually not an Eclipse-specific issue; it's a general
Java-on-Windows issue. It's because of how the JVM allocates memory on
Windows; it insists on allocating a contiguous chunk of memory, which
often Windows can't provide, even if there are enough separate chunks to
satisfy the allocation request.
There are utilities that will try to help Windows "defrag" its memory,
which would, in theory, help this situation; but I've not really tried
them in earnest so can't speak to their effectiveness.
One thing that I've heard sometimes that might help is to reboot Windows
and, before starting any other apps, launch the Java app that needs the
big chunk of memory. If you're lucky, Windows won't have fragmented its
memory space yet and Java will get the contiguous block that is asks for.
Somewhere out on the interwebs there are more technical explanations and
analyses of this issue, but I don't have any references handy.
I did find this, though, which looks helpful: https://stackoverflow.com/a/497757/639520
First the JRE of 32bits can't use more ~1.5Gb of ram. So if you want more, use a 64bits JRE.
Second, When a new JVM starts, this sum the -Xmx property of the all JVM that are running, and check if there is enough memory left on the system to run at their own -Xmx, if is not enough then the error occurs.
I was using Liferay with Tomcat server from eclipse IDE.
I was stuck with this same error on click on server start up.
Double click on server from eclipse.
it open up Server Overview page. Updated memory arguments from -Xmx1024m -XX:MaxPermSize=256m to -Xmx512m -XX:MaxPermSize=256m.
Then it was working for me.
Make sure that Eclipse is actually running the same JVM you think it's running. If you use java in your web browser ever, you likely have a 32-bit version floating around too that might be taking precedence if it installed or updated lately.
To be absolutely sure, I recommend adding these two lines to your eclipse.ini file at the top:
-vm
C:/Java/jdk1.6.0_27/bin
...where on my machine C:/Java/jdk1.6.0_27/bin where the JVM I know is 64-bit is located. Be sure to have the bin folder there.
(As a bonus, on Windows 7, this also allows you to actually "pin the tab" which is why I had to do this for my own usage)
This is the issue of Heap size. Edit your .bat (Batch file). It might be showing Heap size 1024. Change it to 512 Then it should work.
Just put # symbol in front of org.gradle.jvmargs=-Xmx1536m in gradle.properties
# org.gradle.jvmargs=-Xmx1536m
I also had the same problem while using Eclipse which was 32 bit and the JVM used by it was 64 bit.
When I routed the Eclipse to 32 bit JVM then it worked
I know that i am a bit late, but here my answer comes:
I just installed the Java online Version from Oracle(not the offline 64-Bit one).
After having added the JAVA_HOME ENV variable, it just worked!
Hope I could help :)
Probably you are trying wrong options anyways.
I got a similar error with supporting error log:
Java HotSpot(TM) Client VM warning: ignoring option PermSize=32M; support was removed in 8.0
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
Im my case, the software did not support java 8 yet(script was using old JVM arguments) but I had had java 8 by default.
One of the reason for this issue is no memory available for Tomcat to start. Try to delete the unwanted running software from windows and restart the eclipse and tomcat.
Solution is simple. No need to go deep into this issue.
If you are running on 64bit machine then follow below steps:
Unistall 32 bit java first (check in C:\Program Files (x86) for its existence)
Install the newer version JDK kit 64 bit (includes JRE)
Set the environment path (To avoid conflict error if you have two different 64bit JRE)
Check in command prompt by typing javac command.
Restart / Done
You can have two different Java installed but don't forgot to set path.
Please set JAVA_OPTS=-Xms256m -Xmx512m in environment variables, it should solve the issue, it worked for me.
Find out if you are using a 32bit version or 64bit version of Java. To know that use the command
java -version
The 3rd line of the output should give you if it 32bit or 64bit.
If it is 32bit uninstall and install a 64bit version.

VisualVM "not supported for this JVM" on all local applications?

I have already spent a long time to load and test my application, now I need to profile it. But unluckily, the VisualVM always says "not supported for this JVM" on my local applications?
The applications were started on the same JVM with VisualVM.
I found out that (at least under Windows) one can easily write small batch files to run VisualVM in combination with specific JVMs, which is important for me, since I have installed the 32bit JDK alongside with the 64bit JDK (I need both, so this is sensible for me).
I have created two batch files in the folder "S:\applications\visualvm\bin\":
run_32.bat:
#echo off
START "VisualVM 32" visualvm.exe --jdkhome "C:\Program Files (x86)\Java\jdk1.7.0_07"
run_64.bat:
#echo off
START "VisualVM 64" visualvm.exe --jdkhome "C:\Program Files\Java\jdk1.7.0_07"
Obviously, all paths may differ on your system, but the general idea should still work correctly (on all 64bit versions of Windows). The benefit is that I can use the 32bit batch file when I want to use VisualVM in combination with Java applications that run on the 32bit JVM, and so on for 64bit.
The "start" command has the only benefit that the batch file launches the application without waiting for it to finish, so the command prompt window closes immediately. This is not a feature of VisualVM, but of the Windows batch file interpreter.
In my case, even with the JVMs matching (both 64-Bit), the only way to get things working was sending the argument -Dcom.sun.management.jmxremote to the JVM to be monitored. That also works if you are having problems to connect via Java Mission Control (JMC).
According to JMX's documentation, this what the argument does:
Setting this property registered the Java VM platform's MBeans and published the Remote Method Invocation (RMI) connector via a private interface to allow JMX client applications to monitor a local Java platform, that is, a Java VM running on the same machine as the JMX client.
This was supposed to be enabled automatically, but for some reason it wasn't on my Linux.
VisualVM needs to be run with the same JVM - at least Java 6 with the same 32-bit/64-bit size - as the program to be profiled. (You also need to be the same user, but then this message does not apply).
I would be triple-check that it was the exact same JVM in your situation.
On Linux:
Make sure that your /etc/hosts correctly references the effective ip address of your "hostname"
It appears that a discrepancy here totally confuses the poor jvisualvm and its programmers.
I too got the same problem for local tomcat, I search for solutions for stackoverflow. after some serious debugging, I figured out that VisualGC don't have permissions to get GC informations from tool.jar file.
by links
http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstatd.html#SECURITY
https://stackoverflow.com/a/42107355/3876619
I following steps to solve the issue
1) Create a permission file
vim /tmp/tools.policy
Add
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
save it
2) Now add /tmp/tools.policy to JVM startup parameters
-Djava.security.policy=/tmp/tools.policy
3) Run jvisualVm with sudo
An issue that I just found, thanks to the hint from #user3356656, is that if you start the program while your machine is on one IP, and then try to connect while it is on a different IP, it will fail.
I also met this issue. My case is that on linux, I started tomcat with tomcat_user but I run jvisualvm with root user. It works after I start tomcat with root user.
I was having the problem having of visualvm detect my local tomcat installation on Windows 7. I could connect manually, but then things like memory snapshots and visualgc plugin were not enabled. I confirmed that I was using same JVM version, temp file permissions, etc. Didn't work. Then I found that starting visualvm first, and then tomcat, solved the problem.
As you can see, you are running VisualVM on 32bit JVM
You don't need to unistall 32bit JVM. Just tell VisualVM to use tour 64bit JVM.
If you want to change it permanently, you can edit
in visualvm_13\etc\visualvm.conf and specify the path of jvm here
My problem was JVM optimizations - -XX:+PerfDisableSharedMem flag will break VisualGC. This is apparent if jps will not show your app in the listing.
I can reproduce next behaviour.
I have a java application with right-click menu item to open jvisualvm.
I'm running this java application as standalone setup from a bat file.
It means I modify %path% and other needed environment variables like JDK
accordingly to form my environment.
The BAT that starts application is marked running as non-admin. Environment points to a 64-bit JDK.
Then I start other java application as admin. VM lives from the to same 64-bit JDK-source.
Then I start jvisualvm from first app with the right click ie.as non-admin.
I can see the app in jvisualvm ‘Applications list’ but clickin ‘System properties’ gives error. Message is “Not supported for this JVM”.
JVM arguments are exposed.
Solution is like in some other previous comments:
Starting my right-click jvisualvm-starter as admin I can see also "system properties" .
Certainly if JDKs would be 32-bit and other 64-bit it would not work. been there.
I thought this notion needs to be added here.
In my case, the application was running with admin permissions. So, visualVM also need to be running as admin.
I have changed name to my Windows User and set it all lowercase, restarted my PC and it all works now.
For me, the reason is that I have run the "jstatd" with a different user with the JVM process. I have a special user in the linux to start the JVM thread(it is a tomcat), but I start the jstatd process with root. If you use root to run jps, you cannot see any information of the JVM threads belonging to other users. That is the trouble.
I killed the "jstatd" process started by root, su to the owner of the JVM process, and restart the "jstatd" process and everything wokrs fine now.

Categories