You are not logged in.

#1 2012-08-15 11:38:57

funny
Member
Registered: 2008-01-28
Posts: 44

32bit java on 64bit arch

Hi,
I have 64bit archlinux. I have installed eclipse and openjdk from repository so both are 64bit version. But I need 32bit version of java for actual job. So i downloaded it from oracle's web. Now I have two java on my arch (./usr/lib/jvm/java-6-openjdk - 64bit and /opt/java/jdk1.6.0_34/ - 32bit). When I changed $JAVA_HOME to  32bit version, eclipse didnt works. So I change $JAVA_HOME back to 64bit.

And my question. If I add new (32bit) java virtual machine to eclipse and select it for use, will be this 32bit version used for programing?
And what about maven? We use maven for build project. Can I set it to use 32bit java?

Thanks

Last edited by funny (2012-08-15 11:52:52)

Offline

#2 2012-08-15 11:52:24

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: 32bit java on 64bit arch

I have recently done the same, so...

You don't need to make it complicated.

You only need to do two things:
1. Eclipse Preferences -> Java -> Installed JREs -> Add -> Standard VM -> (set the directory of the 32 bit java in JRE home and give it a name like "32 bit java" or whatever)
2. After creating a project, rightclick -> properties -> Java Build Path -> Libraries -> (remove JRE System Library) -> Add Library -> "JRE System Library" -> (in Alternate JRE choose your "32 bit java" or whatever)

It should now compile and execute with the 32 bit java


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#3 2012-08-15 11:55:28

funny
Member
Registered: 2008-01-28
Posts: 44

Re: 32bit java on 64bit arch

And what about maven? We use maven for build project. Can I set it to use 32bit java?

Offline

#4 2012-08-15 12:05:55

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: 32bit java on 64bit arch

No idea, I don't use maven, but maybe it uses JAVA_HOME when you invoke it with

JAVA_HOME=/whatever mvn

?


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#5 2012-08-15 12:16:23

funny
Member
Registered: 2008-01-28
Posts: 44

Re: 32bit java on 64bit arch

This is the problem.  I have to set JAVA_HOME to 64bit version beacause eslipse, virtualbox, ... need it, but maven use java from JAVA_HOME too and I need that maven use 32bit version as eclipse

Offline

#6 2012-08-16 10:23:40

framas
Member
Registered: 2009-07-24
Posts: 50

Re: 32bit java on 64bit arch

you can create a script that wrapps maven with 32 bit java
Call it sth like mvn32 , put this to your $HOME/bin direcotry  and insert following:

#!/bin/sh
export JAVACMD=/path/to/java-32/bin/java
#or 
#export JAVA_HOME=/path/to/java-32/
mvn $*

Then you call mvn with mvn32 clean install for example.
When name this scipt mvn and ensure that $HOME/bin is the first entry in your $PATH variable this scipt will be excuted as first when you call mvn

An other alternative is  edit  /opt/maven/bin/mvn
and adjust the JAVA_HOME Variable to your 32 bit jdk-

Framas

Offline

#7 2014-08-18 18:56:42

funny
Member
Registered: 2008-01-28
Posts: 44

Re: 32bit java on 64bit arch

In the past I returned to 32 bit system.

Now I have new laptop with more RAM and I have installed 64bit archlinux. But I have still this problem.

I need 32bit java beside 64bit. Now i have 32bit java installed from oracle pages. I unpacked tar with 32 bit java to /opt. But when I call java -version or /opt/jdk1.7.0_67/bin/java -version, I see error "Direcory or file /opt/jdk1.7.0_67/bin/java doesnot exists". I dont know where is problem because the file and path is right.

On the first I wanna install and set 32 bit java then I will install 64 bit java for netbeans.

Offline

#8 2014-08-19 09:34:50

aligator
Member
Registered: 2013-10-07
Posts: 75

Re: 32bit java on 64bit arch

have you tried one of these AUR Packages?
https://aur.archlinux.org/packages/?O=0 … _Search=Go

Offline

#9 2014-08-19 10:52:07

Wikimig
Developer
From: France
Registered: 2004-12-10
Posts: 77
Website

Re: 32bit java on 64bit arch

Side note about JAVA_HOME:
You mention you "changed" JAVA_HOME to "32bits" and back to "64bits". If you use packages from extra, JAVA_HOME needs to be set to /usr/lib/jvm/java-default-runtime as set in /etc/profile.d/jre.sh

See this for more info

Offline

#10 2014-08-19 14:58:05

grimpirate
Member
Registered: 2011-10-26
Posts: 42

Re: 32bit java on 64bit arch

Create a 32-bit VMWare machine and install Java, Eclipse, and Maven there. This will avoid all the headaches you're having about trying to get one to work with the other. Use a 32-bit environment if you're developing for a 32-bit system, that's the whole purpose of a virtual machine, to emulate the environment.

As an aside, I fail to understand the reason for 32-bit vs 64-bit as Java is not architecture dependent. The code SHOULD be the same after all.

Offline

#11 2014-08-19 15:29:29

Pse
Member
Registered: 2008-03-15
Posts: 413

Re: 32bit java on 64bit arch

grimpirate wrote:

As an aside, I fail to understand the reason for 32-bit vs 64-bit as Java is not architecture dependent. The code SHOULD be the same after all.

I agree. As a Java developer, I am curious as to why you specifically need a 32-bit JVM.

Offline

Board footer

Powered by FluxBB