Yu Sasaki's Blog

Icon

プログラミングとか英語とかの練習!

Running Eclipse using 32 bit JVM instead of 64 on Apple Mac

I decided to go for Eclipse WTP development, and Jordan asked me to read this tutorial to get a grasp of how to work on.

I’m going to make notes regarding the tutorial and problems that I faced.

Actually I am kinda new to Eclipse so I needed to learn a lot of terminologies relating to this tutorial.

Here’s the summary of some of key terminologies that I learned.

  • Eclipse WTP – WTP is a short for  Web Tools Platform. Eclipse WTP is one of top projects of Eclipse. Eclipse WTP’s goal is to become sort of a defact-standard in web-development by providing Web/J2EE development tools. WTP consists of two sub-projects: WST (Web Standard Tool), JST (J2EE Standard Tool).
  • WST basically covers non-Java development portion such as HTML, XML, SQL….
  • whereas JST covers Java-development portion such as JSP, JDBC, Servlet… WTP integrates these two portions and produces one powerful IDE for web development.
  • JRE – Java Runtime Engine, and JVM is an instance of this.

Let me start my first tutorial for Eclipse.

In this tutorial, we assume that current WTP has the following bug.

When a Web Application is running, in the server view the ToolTip window must display the date nd time when the window is created.

The following picture shows where the problem is.

Bug

Bug

In the picture above, we want tooltip area to display current system date and time instead of “Tomcat v6.0 Server at localhost”

So I started working on this pseudo-bug based on the tutorial. I did not encounter any problems until I reached the point where I was to deploy the change that I made for the target platform.

In the step 4 : Running your Eclipse Application, when I clicked on “Run” on my Development platform, it was supposed to launch the Target platform automatically.

Instead, I encountered the following errors.

java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM

This seems my Mac JVM is 64-bit and SWT (what is this?) needs 32-bit JVM in order to use.

I was a bit confused about the fact that I needed 32-bit JVM instead of 64-bit.

For the time being, I started looking for 32-bit version of JVM using google.

And I found terribly interesting thing here:

Apple is not supporting the 64-bit carbon API. SWT is written using carbon so it must be 32-bit. Apple won’t support 32-bit JDK 1.6. Therefore SWT won’t run on JDK 1.6 (along with any other Java program that had natives that made carbon calls).

Oh, I got it! In short, Apple doesn’t like Java.

At the moment, I could have moved to another platform to work on such as Windows / Linux…. but I wanted to persist with Mac because if I cannot solve this problem, I will be likely to end up mainly working with Windows / Linux platform most of the time during this semester, which is not good for me because I love Mac!

So I started further googling.

and I found a lot of websites attempting to install a lot of things to try to solve this problem.

and finally I found one comment at the end of the article in this blog which was the easiest and simplest way to solve this problem.

What I needed to do was just type in “-d32” in VM argument field

VM argument

VM argument

This forces Eclipse to use 32-bit JVM instead of 64-bit JVM. Very simple answer.

Now that I’m ready for using 32-bit JVM, I can apply changes that I made!

Here’s the result:

Now it displays the current date and time

Now it displays the current date and time

Now it’s working.

Yeah!

See you!

———————————–

In this article, the author is talking about OS X 10.6 Snow Leopard:

There are some major news regarding Java in Snow Leoprad. First, it ships with Java 6 only. This includes 32-bit and 64-bit versions. The 32-bit is something which was unknown until the release of SL and it means Java 6 will be available on older intel machines which are not 64-bit capable (Intel Core Duo). Second, the 64-bit version is the default for users running 64-bit capable machines (Intel Core 2 Duo).

So since Snow Leoprad, which is the latest version of Mac OS, even though it has a capability of running both 32 and 64 bit JVM, Eclipse is defaulted to run 64-bit version of JVM.

Advertisements

Filed under: Java, open source

28 Responses

  1. Peter Liu says:

    Hi, Ysasaki.

    Welcome to the Eclipse WTP world. I enjoyed reading your blog about running Eclipse WTP on the Mac platform.

    Peter.

    • ysasaki600 says:

      Hi Peter,

      Thanks! 🙂
      I spent almost four hours to find the answer lol
      I enjoyed the tutorial and am really excited to work on real bugs.

      Yu

  2. Davoud says:

    Hi Yu,

    It’s great that you followed up on this issue and finally figured it out; well done.

    I just want to tell you of my experience which is, the title of a post is very effective in search engine indexing and result. So try choosing a title that you think people might search for when looking for what you have written about.

    For example for this post, something like “running Eclipse using 32 bit JVM instead of 64 on Apple Mac” would most likely show your blog post on first page of google search result and this can help many people! : )

    Good luck : )

  3. Raffi says:

    As a fellow Senecan, just wanted to say thank you for this. I’ve spent hours trying to figure out how to get Eclipse to use 32bit JVM, and it turns out the solution is so simple. Who knew?

  4. Jakub says:

    Sweet! Your solution saved me a lot of time and possibly switching to Windows.

  5. danilo says:

    you are a great man!

  6. LIC says:

    That’s work. I tried on Eclipse (Mac) and I just added the -d32 in the jvm arguments and it starts working. Also, you can bypass the “Unsatisfiedlinkerror” by this method on MAC. Very useful info. Thanks again.

  7. I in turn solved the above error by selecting Java Version 1.5 instead of 1.6.

    I was trying my PDE Plugin Hello World test

  8. Stephan says:

    Thanks, I was already installing eclipse (again) to get my program running.

    You’ve saved me a lot of time! 😉

  9. Nicolo says:

    iloveu!

  10. bryan says:

    Hi Ysasaki,
    Thanks for taking the time to write this up. It solved my plugin problem.

    One comment, you joked that “Apple doesn’t like java”, though lately with Adobe, Google and others that its not just java, Apple doesn’t seem to like anyone. But what about a 64bit swt? One could make the argument that its IBM that doesn’t like java. 😉

    Both statements are silly really considering the contributions of both companies (ibm in particular with Eclipse). I just wondered if anyone had any idea when we could expect a 64bit swt for osx. Maybe we already have it, and I’m just that far behind the times???

    Thanks again,

    Bryan

  11. Larry says:

    Perfect! Thanks to you I found this unfortunately “obscure” answer in the first 5 minutes of browsing. You made my new years eve a little easier!

  12. Steve Hutchings says:

    Hi Yu,

    Thanks so much for this post! Worked great. I’m glad this was the first hit for me on google. I’ll be spreading the word about it since there were quite a few more people at my school with the same question.

    本当にありがとうございます!

  13. Peter says:

    Hi – Thanks for this! I’ve sorted out the issue with running this on my Mac. Strange that it is so simple. Why not just use whatever vm is available?

    Peter

  14. Christophe says:

    I get the same error message but it goes away when I change the runtime JRE to match the JRE selected during set-up. (Defaults to JRE7, but I set it up with JRE6).

  15. Peter Pan says:

    Thanks a lot! This was, what I was exactly looking for!

  16. Daniel Hernandez says:

    Also if you are in RCP development you could add the -d32 argument in your application product in the Launching tab

  17. […] If using a Mac Install JDK 32-bit instead of 64-bit even if you’re system is 64 bit […]

  18. Muhammad Mustafa Saeed says:

    you are a life saver dude.. Thanks 🙂

  19. Amit says:

    Thanks for the pointer. I was searching for 32Bit JRE. Unfortunately Apple sucks in this case..
    Weird to see Apple controlling JRE support on their machines not Oracle/Sun. 😦

  20. Mark Martin says:

    This post is still helping people out there. Thanks again for this find!

  21. Jean Melo says:

    It’s so simple! I had this same issue until I read your post.

    Thanks!

  22. Terrible says:

    How to i open that page that has vm argument? Sorry im new at this… i had Eclipse for C++ developer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: