-Xss1m not being used - java

I'm trying to user -Xss1m option but it didn't look like the option was being used.
I did the following steps:
Add a runtime parameter -Xss1m
Open my java applet
Dump system and deployment properties (press on "s" in java console)
Check the value of javaplugin.vm.options (contains only -Djnlp.packEnabled=true)
enviroment details:
java -d64 -version
Got the response of:
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_45-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Do you have any idea how to make it work?

Related

Why is Git Bash not using the correct Java path as defined in the PATH environment variable?

In an instance of Git Bash, typing in java -version gives me:
Error: could not open 'C:\Program Files (x86)\Java\jre7\lib\i386\jvm.cfg'
However, my actual Java path is in D:\Program Files\Java\jdk1.8.0_45\bin. This is shown in my %PATH% variable if I type in either echo $PATH or env | grep PATH.
Where is Git Bash getting this nonexistent Java path from?
P.S.
To add on to this, running java -version in the Command Prompt gives me the correct output:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
Check if you have some old java.exe, javaw.exe, javaws.exe in the c:/windows/system32 folder, as mentioned in "Java path..Error of jvm.cfg".
I just checked with Git 2.6.3 on Windows, where I don't have anything in c:/windows/system32, and the result is consistent between:
git bash:
vonc#bigvonc MINGW64 /
$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
and CMD:
C:\prgs\git\PortableGit-2.6.3-64-bit>java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Both report the same java at the same spot:
vonc#bigvonc MINGW64 /
$ which java
/c/prgs/jdk/jdk-7u51-windows-x64/bin/java
C:\prgs\git\PortableGit-2.6.3-64-bit>which java.exe
C:\prgs\jdk\jdk-7u51-windows-x64\bin\java.exe
Conclusion: upgrade to the latest git for windows.
If you are trying to manually set JDK, then please check if you haven't missed the Oracle Java (C:\ProgramData\Oracle\Java\javapath) in Path Environment Variable under System Variables, remove it and java -version should work just fine.
Check the PATH variable in your .bash_profile file to make sure it reflects the correct version of java. The file is usually in your home directory C:\Users\\{HOME}\\.bash_profile
It will happen when you have running an IDE with another set of JDK instances. The better way to resolve this is set you JDK home in path and make it available in last row. This is working for me.

How to install Java 8 on machine with other Java versions

I installed Java 8 (jdk-8u60-windows-x64.exe) on machine with several other versions.
After installation I see the following message
d:\Userprofiles\user>java -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
I can change JAVA_HOME to the new location but this does not fix the above message.
When I edit the registry and change 1.8 in serveral registry keys to 1.7 I have a working configuration again. But this is still 1.7.
Changing JAVA_HOME does not seem to have any effect. When I change it to my new installed JDK
d:\Userprofiles\user>java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
d:\Userprofiles\user>echo %JAVA_HOME%
D:\Program Files\Java\jdk1.8.0_60
What do I need to do to have 1.8 working on my machine? JAVA_HOME seems obsolete now, should I change the registry? What should I do to change registry so that picks up the 1.8 version?
It's not enough just to introduce the value for %JAVA_HOME% (actually, Java doesn't care if there is or there isn't such environment variable).
What you have to do is to append %JAVA_HOME%/bin directory to the Path environment variable, so that you get the java.exe that matches the %JAVA_HOME% version, without having to write the full path to the java.exe executable that you want to trigger.
So, either do this:
set a value for the %JAVA_HOME% environment variable
append %JAVA_HOME%/bin to the Path environment variable
or just
append <the-java-home-directory>/bin to the Path variable.
Personally, I would prefer to maintain a value for JAVA_HOME, as it is needed by tools like Maven, Hadoop, etc.
You can have as many JDK's installed as you want, and you don't even need them in the PATH, or to set JAVA_HOME.
The first one found in the PATH will be the default one. Remember to only install the JDK, not the JRE that always comes with the JDK, i.e. unselect the 3rd option when installing.
I have 9 JDK's installed, and I can run all of them without changing anything. All you have to do is qualify the executable:
C:\>prog\java32\jdk1.4.2_19\bin\java.exe -version
java version "1.4.2_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
C:\>prog\java32\jdk1.5.0_22\bin\java.exe -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode)
C:\>prog\java32\jdk1.6.0_45\bin\java.exe -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
C:\>prog\java32\jdk1.7.0_79\bin\java.exe -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Client VM (build 24.79-b02, mixed mode, sharing)
C:\>prog\java32\jdk1.8.0_51\bin\java.exe -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode, sharing)
C:\>prog\java64\jdk1.5.0_22\bin\java.exe -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
C:\>prog\java64\jdk1.6.0_45\bin\java.exe -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
C:\>prog\java64\jdk1.7.0_79\bin\java.exe -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
C:\>prog\java64\jdk1.8.0_51\bin\java.exe -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
That was the output in a single Command Prompt, without ever setting the PATH.

java version and PATH on OS X

I'm not sure why my PATH is not being respected regarding where to find java on my MAC OS X 10.9.5.
After searching around I found that the Java version referenced from the command line was at /usr/bin/java, while the Java version referenced by Oracle's tools used by browsers and visible at System Preferences > Java, Open the Java Control Panel, click on Java tab at top, click on View... button, check both User and System tabs for Path, showing in both:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
The command line picks up 1.6.0_65 even though that is for the version at /usr/bin rather than the one at /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin earlier in the path.
Joes-MacBook-Pro:~ josephmurray$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Joes-MacBook-Pro:~ josephmurray$ which java
/usr/bin/java
Joes-MacBook-Pro:~ josephmurray$ echo $PATH
/Applications/tr-sub.app/Contents/MacOS:/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin:~/civix:/usr/local:/usr/local/bin:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.4.19/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/usr/local/git/bin:/usr/X11/bin:/Library/PostgreSQL/9.3/bin/
Joes-MacBook-Pro:~ josephmurray$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Joes-MacBook-Pro:~ josephmurray$ /usr/bin/java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Joes-MacBook-Pro:~
This is preventing me from installing eclipse because it needs Java to be at least 1.7. How can I fix this?
If you want to work with Eclipse, you need to install a full JDK, not use a JRE. The installed JRE is lacking debug symbols etc.
You can install it from Oracle's Java SE Development Kit download page.
You will then also be able to use command line tools such as javac.
The problem turned out to be using a backslash to escape the space in the path. While using it is necessary when entering a command on the commandline, it should not be included when setting PATH in ~/.bash_profile:
export PATH="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin:~/civix:/usr/local:/usr/local/bin:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.4.19/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/usr/local/git/bin:/usr/X11/bin"
export PATH=/Applications/tr-sub.app/Contents/MacOS:$PATH:/Library/PostgreSQL/9.3/bin/
NB: Each time you edit ~/.bash_profile you need to refresh the environment variables in the shell by running:
$ source ~/.bash_profile

What is Java using to output in console, and how can I capture it in ruby?

If I am running IRB and I use the method mentioned here http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-60 to return the ruby version, it works fine.
irb(main):001:0> %x{ruby -v}
=> "ruby 1.9.2p290 (2011-07-09) [i386-mingw32]\n"
But when I try to do the same thing in IRB with Java, I can see it printing to screen but it does not return.
irb(main):002:0> %x{java -version}
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
=> ""
What method is Java using to output to the console, and how can I capture it for use inside of a ruby/rails program?
Java is using STDERR to print its version information. You can capture that easily by routing STDERR to STDOUT's stream, and capturing both.
asdf = `java -version 2>&1`
puts asdf
will output:
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-10M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
This is a very common technique when working at the command-line. Do a man sh at the command-line, and search for REDIRECTION using "/REDIRECTION" and read from there.

Setting HotSpot(TM) Server VM in Java 1.6 environment

I have a question related to setting Java hotspot server VM in java 1.6
is there any way to set Java HotSpot Server VM in java 1.6 environment? When i run following command
java -version
it's showing as below,
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
I want this has to be displayed as below in third line.
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode, sharing)
Is there any command so that whenever we run java -version, it will always show Hotspot Server VM rather Client VM??
Thanks
Robert.
Add the -server flag:
java -version -server
outputs
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)
You should try 'java -server -version' instead. You will need to have the server hotspot compiler installed or use that on the JRE that comes bundled with the JDK (which comes with server hotstpot).
I seem to remember reading somewhere that the JVM will start in server mode automatically if the system meets certain specifications in terms of number of processes and amount of memory. Can't remember the details or find the info though.
Edit: Found some info here
http://download.oracle.com/javase/6/docs/technotes/guides/vm/server-class.html
Server class machine is > 2Gb RAM and > 2 processors.
Simply add the '-server' flag !

Categories