views:

1493

answers:

3

Hi:

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.

+6  A: 

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).

Fredrik
Cool - thanks for clearing that up.
red.october
+1  A: 

You can run a 64 bit JDK or JRE in Windows 7 I am running them now.

Java SE Development Kit 6u16

Java SE Runtime Environment 6u16

Choose which OS from the drop down you have a choice of Windows 32 or 64 bit.

Menuta
I should probably split this question up - Fredrik answered my general questions, but you answered how I could get the 64-bit JDK6 (so I gave both answers a +1). It turns out my problem was that I tried to download the JDK+Netbeans combo EXE, and that one automatically comes with the 32-bit version of the JDK. Thanks.
red.october
+1  A: 

There is no such thing as a 64 bit java 'application'. Java compiled classes are in java bytecode, period. Executing the programs on a 64 bit JVM (which in turn requires a 64 bit OS) gives them access to more memory, but the difference is invisible to the program since all access to memory manipulation is hidden and all datatypes are the same.

See also this question

Jherico
@Jherico: In this case I feel that your answer is semantic pap, he wants to access amounts of memory which exceed the limits of a 32b JVM, and to debunk your idea of no such thing, he could use Long for every variable and it would indeed be a 64b Java App. (Pointless, but possible.)
_ande_turner_
@sudo noob: I think Jherico correctly answered my question. A Java application without native code doesn't have a 32-bit or 64-bit version (which was what I was asking) - you write and compile it once, and things such as how much memory it can access are dependent on the JVM and hardware platform. I don't think the 64 in 64-bit application means all data types are now 64 bits in length (I think a char is still 8 bits long in 64-bit C applications).
red.october