Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

64-bit Java Apps: Is a 64-bit OS, 64-bit JRE and 64-bit Application required?

This question is about 64-bit Java apps in general, although I came upon it because of working with Netbeans/Eclipse. I'm using a 64-bit processor with a 64-bit OS (Windows 7). I wanted to run Netbeans/Eclipse with more than 4GB of heap memory (i.e., using the Xmx flag), but I'm running into some confusion. There doesn't appear to be a 64-bit version of Netbeans, and while there are 64-bit versions of Eclipse for other OS's, there isn't one for Windows. Furthermore, I cannot find a 64-bit version of the latest JRE/JDK (I've read sites mentioning the existence of these, so I'm not sure if Sun has just temporarily taken them down).

Now that I've explained my situation, my questions are as follows:

  1. What software do I need to run Netbeans/Eclipse/(random Java application) with more than 4GB of heap memory? Is having a 64-bit OS sufficient? Do I also need a 64-bit JRE?
  2. I thought Java source code and Java bytecode was architecture-independent, as in a Java program compiled with either a 32-bit of 64-bit JDK can be run on a different machine with either a 32-bit or 64-bit JRE. If this is true, why does Eclipse have a 32-bit version and a 64-bit version (I realize they don't have one for Windows, but they have one for Linux)? Does this mean that Eclipse likely has native libraries, for which 32-bit vs. 64-bit would matter?

Thanks in advance,
red.october

Update 1:
Ok, it turns out there is a 64-bit version of Eclipse for Windows, but its buried deep for some reason (at least it I didn't see where it was linked from the main page). After searching around for quite a bit, I found a blog post which stated that you can get 64-bit Eclipse for Windows at Eclipse Downloads. That link points to a page with links to many different release versions - I just picked the most recent stable release (3.5.1 at the time of this post). This second page lists various downloads for Eclipse 3.5.1, and for each download, you have a wide range of architectures (32-bit and 64-bit) and OS's (e.g., Windows, Linux) to choose from. I personally chose the Eclipse SDK download - this comes with "Eclipse Platform, Java development tools, and Plug-in Development Environment, including source and both user and programmer documentation". I'm not sure I need the source or documentation, but I figure I can always remove it later.

like image 807
red.october Avatar asked Feb 04 '23 08:02

red.october


1 Answers

Yes, you will need a 64 bit JVM to utilize all your memory. I am not up to date with what you can get for Windows so I will let someone else answer that.

However, I think the main reason why you can't find a 64 bit netbeans is that it is 100% pure java and architecture independent. Eclipse provides an alternative GUI framework with a more native look and feel (SWT) and uses it for the development environment itself. Once you link to your java app to native libraries you need to distribute the libraries for the correct architecture, hence the architecture dependence of the eclipse distribution (your second item).

like image 103
Fredrik Avatar answered Feb 06 '23 14:02

Fredrik