Am getting the following error message while trying to run java. I have typed in java -version but am getting error:
C:\>java -version
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Error occurred during initialization of VM
Could not find agent library jvmhook on the library path, with error: Can't find
dependent libraries
Java is being invoked in a slightly abnormal way.
I have multiple answers depending on your Java version number and whether or not you wish to perform automated testing on your computer.
HP's Quick Test Professional (QTP, an automation tool) has been installed on your computer; this is the program which creates _JAVA_OPTIONS (and usually also IBM_JAVA_OPTIONS) to be what you observed in your post:
-Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
QTP puts these in place so that it can recognize Java objects, allowing you test a Java application.
It also can create environment variable
JAVA_TOOL_OPTIONS with
-agentlib:jvmhook
which is required for working with Java 1.6
If you do not require QTP to perform tests against Java applications then you can experiment with removing these environment variables.
Pro-tip for easy reverting, just amend the Environment Variable names (e.g. rename _JAVA_OPTIONS to IGNOREME_JAVA_OPTIONS)
*Environment variables require local admin privileges and a system restart to take affect.
If you are using Java version 1.5 or older then you can probably get away with removing JAVA_TOOL_OPTIONS only.
The jasmine.jar seems to be troublesome to a number of java applications; I have had considerable difficulty with this stopping my applications from running in the past.
The _JAVA_OPTIONS environment variable is making some very serious modifications to your Java environment -- and obviously doing it wrong, since it's not launching. I don't know what is setting that environment variable, but if it's not something you're trying to do yourself, if I were you I'd make a note of the value just in case you need to restore it, then go to your Windows "System" Control Panel and remove _JAVA_OPTIONS altogether.
I'm using Intellij IDE. Removing .idea folder from project's local directory solved this issue.
Related
Only this fixed my error:
If you are not able to launch a jnlp application after installing UFT
on you machine, Just uninstall UFT and try to launch the application
and then install UFT
I am not sure what to do when this issue is back as I didn't really solve the issue structurally. My question is what could have made this behavior possible? During the issue phase, I was not even able to launch Java Control Panel (.cnpl) or javaws instance for any jnlp. changing the environment variables also didn't work. Reinstalling Java also didn't.
The environment variables that UFT adds by default for Java Add-In might be causing issue.
Try removing or renaming JAVA_TOOL_OPTIONS and _JAVA_OPTIONS environment variables, although if you want to load Java Add-in support for your application these environment variables are needed.
Read below for more information:
https://admhelp.microfocus.com/uft/en/14.50-14.53/UFT_Help/Content/Addins_Guide/Checking_Java_EnvironmentVariables_Settings.htm
My environment is Windows 10, JRuby, and Java 1.8.
Running the JRuby program
java_import javax.swing.JFrame;
JFrame.new("abc")
(which is actually part of the jirb_swing script that comes with JRuby) now results in an error
java.awt.AWTError: Assistive Technology not found: com.evidian.wg.jpi.WGJPI
I am not aware that I have changed something in my Java/JRuby configuration, although our centrally managed Windows 10 might have been updated overnight. In any case, the code has worked so far without error.
I have found this link to a similar problem, but it refers to WSL, and I don't use WSL.
SOLVED the case by installing a fresh copy of Java (for the safe side, I installed all of the SDK, and not just the Java runtime) in addition to the existing one (i.e. I did not make an uninstall), and I made sure that the JDK's bin directory is first in the PATH. I also set the JAVA_HOME environment variable to this directory (it was unset before). After doing this, the error seems to be gone.
I was reading some articles about how jvm works, and i tested that if i change the jre from Eclipse(installed JREs), the code will be executed in that jvm. So my question is why the eclipse needs to have JAVA_HOME set in environment variables. Does eclipse use that JRE in any form if i select another in Eclipse(installed JREs)
Eclipse does not require JAVA_HOME to be set, but as info for you, many MANY tools that you can find over the web use inter under the hood oracle tools, those will never run if your computer has no idea where they are located, JAVA_HOME is just a variable in the enviroment, so you( and the tools you use) can execute things like javac or java without telling every time where those are in the pc
.
I want to install BlueJ manually for portability reason. I have set Java_Home and add Java bin directory to path environment variable. I'm using a symlink on c:\java which points to d:\java on sd card.
Why BlueJ does not take them into account still pretending it cannot detect jdk.
Update : Eclipse is OK so is there something specific with BlueJ and Jdk 1.8 ?
I've just done a clean install of BlueJ and JDK 1.8 on separate drives to replicate your problem. I made a symlink to the JDK and put that in JAVA_HOME and PATH (from your use of C:\ syntax, I guessed you were on Windows, so I tested on Windows 8.1).
I too found that the setting of environment variables was ignored by BlueJ in selecting a JDK to use when it is running. I could change JDK by using the companion program Select BlueJ VM, but could not enter a symlink there (I believe on earlier versions, changing VM was a setting on the start menu, not a separate program).
In summary:
It is not a problem with BlueJ and Java 8 compatibility
It is not a problem with the symlink
For Windows at least, It is due to the way that BlueJ determines and stores which JDK it uses (both actions via the registry).
You can manually change the registry key to your symlink if you want (see details below), but that's an extra install step.
In detail
I found that BlueJ stores that path to the JDK it uses in the following registry key
HKEY_CURRENT_USER\Software\BlueJ\BlueJ\3.1.5\CurrentVM
Note the root could be HKEY_USERS or HKEY_LOCAL_MACHINE depending on whether you installed for one user or all users of the machine.
The issue is that this key is set automatically if your system has only one VM available at runtime, or on the first run of BlueJ or with the Select BlueJ VM program at any time later. The options offered to you there are the JDK's that the launcher can detect (via the registry) on your system at that moment. Once that value is set, it is not changed dynamically at runtime to reflect JAVA_HOME. Even using the "Browse" option from the options, I could not set the symlink as the JDK location via the GUI.
You can, however, manually change the value of that registry key (e.g. via regedit) to your symlink value (tested and verified OK - might need administrator permissions).
I looked at the source code to determine how CurrentVM is set.
After a fairly short trawl (kudos to BlueJ devs for good naming), I eventually worked out that the actual code used to launch BlueJ is the C++ file in \package\winlaunch\bjlaunch.cc (source file mercurial link here).
That simply checks for the value of the registry key and, if it doesn't exist, if calls findRegistryVMs(), which checks the registry (NOT environment variables) for available VMs and offers those to the user. So, there doesn't appear to be a way to get BlueJ to use the value from JAVA_HOME without a manual registry edit.
N.B. If you do manually change this key value to the Symlink, you can change where the symlink links to and (with a restart) BlueJ will use whichever JDK the symlink linked to. Again, tested and verified on Windows 8.1
N.B. 2 At first, things looked optimistic: in Installer.java there is a method called findJavaPath() that first checks
String javaHome = System.getProperty("java.home");
before having a few guesses if that doesn't work. So it looks like it should respect the value of JAVA_HOME at install time. However, it seems to only use that to check that there is a compatible (1.6+) version of Java available.
Background
As this is the first question I have posted, I will try to break it down as well as possible, and I apologize for any incorrect formats. I should also point out that I am brand-new to Linux, Tomcat, and Java (all within the last few weeks), so if you do have an answer please dumb it down as much as you can. Thanks!
This question is actually several questions, but I feel the issues are somehow related so I will include them all. As for my environment, I am running an EC2 Amazon Linux instance. Details returned using
cat /proc/version are:
Linux version 2.6.35.14-97.44.amzn1.x86_64
(mockbuild#build-31006.build)
(gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC)
java -version gives me:
java version "1.6.0_29" Java(TM) SE Runtime Environment (build
1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
Issue(s)
What would allow me to stop/restart Tomcat sometimes, but not
others? After I change configuration parameters and need to restart
Tomcat, I use /etc/init.d/tomcat6 restart or service tomcat6
restart with varying degrees of success: sometimes the nice green
OK, others the red FAILED. There seems to be no rhyme or reason to
why it works sometimes and not others. When it doesn't work I check
the status with service tomcat6 status, which yields something
like tomcat6 (pid ####) is running. Also worth noting is that my
Putty SSH session slows down significantly at the same time whenever
I am unable to stop Tomcat. I literally have to wait for each keystroke to be processed!
I cannot use any of the JVM-specific -XX parameters. I get an error
every time of Could not create the Java virtual machine. Of the
threads I've read about this, most surround heap memory allocation
issues, but I don't think that's my problem because when I run java
-XX, which should give me a list of available commands just like java -X does, I simply get:
Unrecognized option: -XX Could not create the Java virtual machine.
I should note that I had at least two versions of Java on this OS- it came with Open JDK, but I needed Sun Java as that was recommended for performance in Geoserver (which is the whole point of me learning all this). I read that it is not an issue to have two versions, as long as my JAVA_HOME path points to the correct directory, but is it possible that it was still somehow looking at something from the original configuration? That's what I thought, so to rule it out I did a yum remove java, which erased the original version (along with Tomcat due to the dependency, but whatevs, I can get it back later), ran java -version to make sure I still had the version I wanted. I did, then ran java -XX, hoping that it magically fixed itself after cleaning house with the unwanted OpenJDK removal, but NOPE, same error as before.
Conclusions
I am now assuming that there was no issue with old paths. I've also tried changing my JAVA_HOME variable to the appropriate path (/usr/java/jre1.6.0_29) in every conceivable location:
in bash_profile
in bashrc
java.conf
tomcat6.conf (well, before I deleted Tomcat, that is)
probably some other files. It's all a blur really.
export JAVA_HOME in the shell
... all with zero impact, with the exception of using export JAVA_HOME=/usr/java/jre1.6.0_29. Every time I ran echo $JAVA_HOME I would still get the original JAVA_HOME path, which I'm pretty sure is not what I want. Even when resetting the variable was successful (via export in the shell), I still got my -XX error. I also tried setting some JAVA_OPTS parameters, specifically for memory settings, then ran an echo $JAVA_OPTS that returned nothing.
I have spent a solid two days on this and am about ready to give up. I would really like to avoid reinstalling and reconfiguring a whole bunch of stuff if possible, not to mention I don't even know if that would fix my problem, but I would really, really like to know WHY I having these issues and whether or not they're related, so if any of you have suggestions on this or anything in general that I'm doing incorrectly, please let me know. Thanks!
I can't help you with the first issue but in regard to your second issue: "I cannot use any of the JVM-specific -XX parameters.":
the environment variable CATALINA_OPTS is used by tomcat when starting the JVM. So if you want to use 512mb of heap and 128mb of perm gen space you can issue the follwing command on a bash shell to start tomcat with some custom java options.
#> CATALINA_OPTS="$CATALINA_OPTS -Xmx512m -XX:MaxPermSize=128m" $TOMCAT_HOME/bin/catalina.sh run
you can also change the default parameters by changing CATALINA_OPTS in tomcat's startup script or you can add the paramenter to your environment (e.g. $HOME/.bashrc).
hope that helps.