what is the default Garbage-Collection for Java 7 - garbage-collection

I know the default Garbage-Collection for Java 6 is serial/serial-old in client mode.
But I don't know, what is the default Garbage-Collection for Java 7 in client mode.
Anyone can tell me what is the default for Java 7?

Assuming you are using an OpenJDK based build of JDK 7 you can use the -XX:+PrintFlagsFinal option on the command line. This will tell you what flags have been set by default (as well as any you have explicitly set, but then you know what they are because you set them).

Related

Logstash issue with Java 11

I am trying to load mysql data to elasticsearch using logstash.
I tried almost every version of mysql-connector-java.jar but everything fails.
can someone help me regarding this?
which version of mysql-java-connector is used with java 11.
Elasticsearch 7 works fine with JDK 8 — see the supported JVM matrix. This will be the easiest way.
You might be able to split into multiple JDK versions on a host with some trickery, but you're off the beaten track. Either you could
change the configuration files to point to the right Java version (though that might be tricky with updates)
Set different JAVA_HOME for the different users running the services.
Also note that in Elasticsearch 7 the JDK is automatically bundled with the binary and if there is no JAVA_HOME set it will fall back to that one.

In Android Studio how can I configure my project to use Java 8

I recently started development with Android Studio 1.1.0 (bundle 135.1740770 for Windows) having JDK version "1.8.0_40" installed (64 Bit).
So far everything works fine, except I cannot import classes added with Java 8. I recognized it when trying to import java.util.Optional, but it's the same with e.g. java.util.stream.
May it be the case that my project somehow only uses a Java 7 subset of my JDK's standard library? And is it possible (recommended) to change that? I looked for a java version param in properties files, manifest and IDE settings. Didn't find anything like that.. anyone experienced something like that?
Btw. following the first comment in Is it possible to use Java 8 for Android development? it should be possible basically, but it seems to only cover Eclipse..
If you read further down in your linked comments, you will find the solution:
You may use JDK 6 or above for Android development. However, the compilation supports Java version 6 (and 7 in case of KitKat).
So yes, you may use JDK 8 for development, but you need to set the language level to JDK 6 or JDK 7. You cannot use any features that were added to JDK 8. To set the language level in Android Studio, go to:
File > Project Structure > Project > Select Project language level

Eclipse Luna Not Working (Kali Linux)

Every time go to run the Linux Version of Eclipse Luna SR2, it just stops at the little Splash Screen (The window that comes up before you select your work space) and it just stays like that for about 30 seconds, and then closes. Any help please?
It generates this error log which is found Here
New Answer: This is a known bug and a workaround that has fixed the issue in at least one case is to run
export SWT_GTK3=0
before starting Eclipse. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=430736 for more information. If this workaround does not fix your issue make sure GTK3 is installed and upgrade glibc to at least version 2.14 to ensure Eclipse uses it. Apparently when Eclipse detects an older glibc it tries to use GTK2. If none of these suggestions fix your issue you should submit a bug report at http://bugreport.java.com/bugreport/crash.jsp to work it out with the Eclipse development team and also to help inform other people about it.
#ElectroMan - This got too long for a comment. Yes, the error log says the same thing. That means you are running Java 6, "JRE version: 6.0_34-b34" according to the log. I suggest you try running Java 8 or at least Java 7. Java SE 8u40 is the current release from Oracle and it can be downloaded for 64 bit Linux from a link on http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. It is best to use the latest Oracle release and get away from the OpenJDK version, especially one that is two major releases outdated. However, if you opt for Java 7 its final release is available at http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html. You should be able to install either in a non-default location and keep OpenJDK 1.6.0_34 as your main version of Java on your platform. Eclipse can be configured to use Java 8 or 7 after it is installed by project or as its default for all new projects, but the main thing is to tell it to use Java 8 or 7 when it runs, since it is a Java application. Some instructions for this are at http://www.cs.umd.edu/eclipse/install_java8_luna.html. One of the main reasons for upgrading from Eclipse Kepler to Luna is to get built-in Java 8 support. Another option is to follow the instructions in the error log and file a bug report at http://www.cs.umd.edu/eclipse/install_java8_luna.html and wait for a reply. Or maybe there is already a new Luna update and you could try it.

How do I detect whether 32-bit Java is installed on x64 Windows, only looking at the filesystem and registry?

I need to determine whether a particular system has 32-bit Java installed. I'm doing a remote query that only gives me access to the filesystem and registry, so I cannot attempt to run java.exe, or run any Java code.
I also want to make sure I detect both IBM and Sun Java, as well as any other distributions, which seem to put things in different places on the filesystem and in the registry.
The best I've come up with is to check for C:\Windows\SysWOW64\java.exe. Is this a reliable way to test for the presence of 32-bit Java, or are there certain versions that won't put java.exe in that folder?
Update: I'm still looking for a more robust answer to this. Just to be clear, I don't have access to a command prompt. Also, I want to detect Java no matter who the publisher is, what version number is installed, and no matter what path the user chose to install it on.
C:\Windows\SysWOW64\java.exe seems to fit these requirements, but I'd love some confirmation from someone more knowledgeable that every Java installer will indeed put that executable there.
This seems to provide the info on Windows:
1.) Open a windows command prompt.
2.) Key in: java -XshowSettings:all and hit ENTER.
3.) A lot of information will be displayed on the command window. Scroll up until you find the string: sun.arch.data.model.
4.) If it says sun.arch.data.model = 32, your VM is 32 bit. If it says sun.arch.data.model = 64, your VM is 64 bit.
Do you have access to the command prompt ?
Method 1 : Command Prompt
The specifics of the Java installed on the system can be determined by executing the following command
java -version
Method 2 : Folder Structure
In case you do not have access to command prompt then determining the folder where Java.
32 Bit : C:\Program Files (x86)\Java\jdk1.6.0_30
64 Bit : C:\Program Files\Java\jdk1.6.0_25
However during the installation it is possible that the user might change the installation folder.
Method 3 : Registry
You can also see the version installed in registry editor.
Go to registry editor
Edit -> Find
Search for Java. You will get the registry entries for Java.
In the entry with name : DisplayName & DisplayVersion, the installed java version is displayed
Check this key for 32 bits and 64 bits Windows machines.
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
and this for Windows 64 bits with 32 Bits JRE.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment
This will work for the oracle-sun JRE.
just write "java -d64 -version" or d32 and if you have It installed it will give a response with current version installed
If it is not Oracle's Java, you may not be able to tell. When I install Oracle Java 64-bit, the files go into C:\Program Files\Java, but when I install a 32-bit version, they default to C:\Program Files (x86)\Java instead. Of course, the person who installed Java could have overridden those defaults.
I tried both the 32-bit and 64-bit installers of both Oracle and IBM Java on Windows, and the presence of C:\Windows\SysWOW64\java.exe seems to be a reliable way to determine that 32-bit Java is available. I haven't tested older versions of these installers, but this at least looks like it should be a reliable way to test, for the most recent versions of Java.

JavaME: make emulator run a different JRE

My first steps with JavaME, currently using Sun's WTK 3.0
I understand a JavaME device runs its own Runtime Environment, and that's a 1.3 JRE.
Is it possible to make the emulator run the JavaSE JDK 6 ?
The JavaME runtime is not JRE 1.3
It is a Microedition runtime BASED on what java standard edition was back around the time JRE 1.3 was released.
You can use JavaSE JDK 6 to develop a JavaME runtime (that's pretty much what microemulator is) but the application management and lifecycle of a MIDlet doesnt match that of a JavaSE application.
You cannot use the latest specification of the JavaSE language (genericity... ) when writing MIDlets.

Resources