Java and Eclipse - 32 vs. 64bit - eclipse

I'm a little bit confused about the two different versions of Eclipse - 32/64bit.
As far as I know, Java bytecode (= build of your code) is platform independend. If a user runs your bytecode in a 32bit JRE, the code is executed in as a 32bit process, if a user runs your bytecode in a 64bit JRE, the code is exectued as a 64bit process.
Eclipse needs the JRE to run, cause it's written in Java. But why are there 32 and 64bit versions of Eclipse on the Eclipse download page if only the user's JRE version does matter?
Does a 64bit Eclipse version need a 64bit JRE or JDK? If yes ,why?
Second confusion: I understand the need for a 32 and 64 bit version of the JRE. But why are there 32 and 64 bit versions of the JDK if the resulting bytecode is platform independet?
Thank you

Eclipse relies on SWT, which is essentially native code. There will be quite a few DLLs etc. exists (in the plugins or features directories) that will be used by the 64-bit version, that are drastically different from the 32-bit version.

It is not because of the running environment, it is because Eclipse uses some native stuff and must be run on corresponding JDK. The applications you are developing inside Eclipse can then be run on whatever JRE you have installed, just specify it in the settings.
JDK is a compiler and also a lot of other stuff. Many of them are native applications that need to be run corresponding platform.

Related

Is Eclipse 2018-12 availabe for 32 bit Windows or Linux?

I need to install Eclipse 2018-12 modelling tools on my 32 bit machine.
In the official site it is available only for 64bit machines.
I tried to download Eclipse 2018-09 and then upgrade it to Eclipse 2018-12 but the upgrade process creates p2bu file and deletes the application files.
No, in Eclipse 2018-12 (4.10) the support of 32-bit platforms has been dropped.
See Eclipse 4.10 - New and Noteworthy - Dropped support for 32-bit platforms:
Eclipse and eclipse based applications no longer run on 32 bit
platforms or 32 bit JVM. Only 64-bit platforms/JVM are supported.
See also Eclipse bug 536766.

javah.exe not included in Windows JDK 8?

I'm trying to learn JNI on Windows 7 64-bit, but JDK 8 does not include javah.exe. I tried both the 32-bit and 64-bit versions. The Oracle documentation shows that javah is part of JDK 8 and doesn't make any platform distinction. Is there a separate download for JNI?
Also, the tutorials that I could find on JNI on Windows are pretty old - is there a newer way to do JNI in Windows, or does anyone have any suggestions for current Windows JNI Tutorials? NetBeans is my preferred IDE, but I'm not exclusive.
Hej Kevin, there is no seperate download needed for JNI and javah.exe is included in your JDK, search for it in %JAVA_HOME%/bin (if you don't have set this environment variable, look into C:\Program Files\Java\jdk1.8.0_121\bin or the version you have). Make sure you have downloaded the JDK, not JRE. And, the best JNI tutorial to start with is indeed that one, at least for me it was.

Improvement: decoupled jre version for installer and application possible?

For now it seems to be impossible the decouple the jre for the main application from the jre used by the installer/updater itself. But sometimes there is a reason to use two different jre/jdk. Maybe the application needs java 8 and the installer is built with java 7 or older. Or maybe there are two applications to install which use two different java versions. Another idea is to create some kind of a meta installer that decide during runtime whether to install 32bit or 64bit java depend on the underlying platform architecture? The installer itself then has to use a 32bit version. So what about to decouple it and configure the jre for the application launchers itself independend from the java version of the installer/updater?
Starting with version 6.1.2 the launcher wizard will have an option to configured the JRE search sequence differently from the installer.
The setting will be available under the "Java invocation->Override Java version" step.

Eclipse JVM version issue: System.getProperty("sun.arch.data.model") returns 32 bit but i want 64

If i run "java -version" it returns 64 bit, which i guess means that my default JVM is 64 bit? but eclipse is using 32 bit since System.getProperty("sun.arch.data.model") returns "32".
I can't use the libraries i need in 32bit mode, jogl which auto detects my platform and incorrectly tries to load a 32bit dll. See more information in my other question: https://stackoverflow.com/questions/14007335/eclipsejogl-issue-cant-load-amd-64-bit-dll-on-a-ia-32-bit-platform
I'm running 64 bit windows 7, eclipse, java and JDK. even tried uninstalling Jre 32 bit to no avail.
Someone else having a similar problem with no solution given: How to reconfigure eclipse to use a 64 bit JVM
Can anyone tell me how i can specify the correct jvm?
That "trick" is just the normal configuration file for eclipse and it's used to specify the full path for the VM that the user wants to adopt.
The standard JVM also offers the -d64 that tries to force the adoption of the 64 bit memory model.
If you want to keep your environment compatible as much as you can with the libs out there you should keep the 32 bit version, and I'm saying this because of my experience with java, also the 32 bit version is probably more stable than the 64 bit version, especially when interacting with external libs ( again in my experience ).
Anyway keep in mind that you need the 64 bit version of Eclipse, otherwise you will go nowhere.
You should install a 64 bit version of Eclipse. Or what you can do is edit the Eclipse.ini file, and change the path it uses for java.exe or javaw.exe to start eclipse to point to your 64 bit version. Also make Eclipse.ini is picking up the right JAVA_HOME environment variable, which may be whatever that value is set to in Windows.
Eclipse has environment variables it uses, but it picks most of them up from Windows. If you change the ones in Windows, you need to restart Eclipse to pick up the new values. I think Java changes the JAVA_HOME variable anytime you install a new version.
Maybe you can tell eclipse where is you own JDK.
Eidt the eclipse.ini in eclipse home dir:
-vm
/path/to/jdk64/bin/javaw.exe
If you want to compile a project in eclipse with jdk 7, click here.

JDK/JRE/JVM/Java SDK | What do they all mean? Sometimes you can develop with JRE and sometimes you need JDK?

To tell the truth, I am quite confused on all these terms (JDK/JRE/Java SDK). I am not sure what each one does.
When I first started doing simple java examples in eclipse, I am pretty sure I only had the JRE, which I believed was the default java installer regular users use to be able to run java programs/applets on their system.
However, now in class we are using Google Appengine, and this requires the JDK which I am guessing is the same as Java SDK. After wasting some time finding out that installing the JDK meant I also had to add java/bin to the environment variables to get javac -version to work in the command prompt I find that only the JDK has javac...
How were my early java programs working without having installed the JDK and therefore not having javac? And really the main question... What is the difference between the JRE and JDK, and when do you use each one?
Thank you :)
JRE = Java Runtime Environment - what you need to run programs/software that require Java or use libraries written in Java. For example, OpenOffice requires the Java Runtime Environment
JDK/Java SDK = Java Development Kit/Java Software Development Kit - what you need to write programs that require Java or use libraries written in Java. For example, if you were to write your own word-processing tool in Java.
java comes with the JRE because it launches the VM (virtual machine). It can take in class files which are files that have been compiled using the JDK.
The JDK comes with javac because that's what you need to compile your .java files into .class files that can then run on the JRE.
Eclipse has its own built-in compiler (called ecj), which is probably the reason you could get away with not having the JDK installed to use it. It does not use javac.
Google App Engine uses the javac that comes with the JDK.
What is the difference between the JRE and JDK and when do you use each one?
JRE: Java Runtime Environment. It is used to run Java programs only. As Chris Jester -Young mentioned, Eclipse had a built in compiler. That's why you just needed JRE ( to run eclipse )
If you ship a Java program, the only thing the client need to have is this runtime environment
JDK: Java Develpment Kit, this also includes a JRE inside, but additionally have other tools for program development such as the java compiler javac among many others.
If you want to create java program you should use this.
There's no way you used the JRE to compile Java programs. javac, the Java compiler, only comes with the JDK.
You may write Java programs with whatever text editor, you don't need anything special to do this.
You need the JRE to run Java programs. The JRE includes the Java Virtual Machine, needed to run already compiled Java programs.
You need the JDK to compile Java programs. So if you are a Java developer, you may want to only install the JDK since it comes with the tools needed to compile, in addition to the Java Virtual Machine.
'Sometimes you can develop with jre'
No. Never.
You develop with the Java Development Kit. You run with the Java Runtime Environment or Engine or whatever it's called.