You are not logged in.

#1 2004-06-30 03:08:01

steelerguy
Member
From: Stony Brook, NY
Registered: 2004-03-20
Posts: 27

JAVA_HOME

I am trying to build the jedit package but I am having problems with the JAVA_HOME env variable.

The build keeps looking in /opt/j2re for tools.jar.  I have manually set JAVA_HOME to /opt/j2sdk, put it in my .bashrc, set the JAVA_HOME variable in the PKGBUILD script, and even tried removing /etc/profile.d/j2re.sh.  This was all to no avail, when I run the makepkg it is still looking in /opt/j2re.

Where am I supposed to set this this variable?  This is my first time using makepkg so I am still learning the ropes.

Thanks!

Offline

#2 2004-06-30 03:30:09

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: JAVA_HOME

What PKGBUILD are you using?

JEdit is in hapy's TUR, isn't it? but it may not be up to date.

You might try exporting JAVA_HOME just before you run makepkg.  You should probably also have to export it as root (in root .bashrc instead of in users) because makepkg runs in fakeroot. I don't know if it uses root env vars or not.

Dusty

Offline

#3 2004-06-30 08:59:57

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

Dusty wrote:

You might try exporting JAVA_HOME just before you run makepkg.  You should probably also have to export it as root (in root .bashrc instead of in users) because makepkg runs in fakeroot. I don't know if it uses root env vars or not.

Fakeroot is specifically meant to be used without any root stuffs at all.  That's the point of it.  Don't touch anything of root's to make it work with fakeroot, because it won't.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#4 2004-06-30 17:47:47

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: JAVA_HOME

This is a problem with the way that j2sdk and j2re are packaged. Since /opt/j2sdk/jre is symlinked to /opt/j2re, the jvm returns /opt/j2re as the System.getProperty("java.home"); even if you have your environment variable JAVA_HOME set to /opt/j2sdk.

The only way to fix it is to rm the /opt/j2sdk/jre symlink and cp /opt/j2re into /opt/j2sdk/jre like so

rm /opt/j2sdk/jre
cp -r /opt/j2re /opt/j2sdk/jre

hth,
-wd


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#5 2004-07-01 01:43:30

steelerguy
Member
From: Stony Brook, NY
Registered: 2004-03-20
Posts: 27

Re: JAVA_HOME

Excellent!  Thank you wdemoss that did the trick.  I thought the packaging of the jre and sdk was weird so I looked it up and saw that it had been split.  Now I know why just linking /opt/j2re to /opt/j2sdk didn't work when I tried that last night.

Thanks again everyone for you help.

Offline

#6 2004-07-01 04:52:01

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

So, now that we know the problem, how do we fix it?  I originally split j2re and j2sdk because people complained about having to download so much to be able to use the java plugin and whatnot.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#7 2004-07-01 11:46:39

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: JAVA_HOME

Xentac wrote:

So, now that we know the problem, how do we fix it?  I originally split j2re and j2sdk because people complained about having to download so much to be able to use the java plugin and whatnot.

I can not think of another way to fix it besides having the full jre in the j2sdk. Perhaps, don't make the j2sdk depend on the jre. That way a person can install one or the other, depending on whether or not they are a java developer. If you have the j2sdk installed, there is no need for the j2re.

just a thought,
-wd

EDIT:
if you like, i'll submit a bug about it.


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#8 2004-07-01 15:06:40

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: JAVA_HOME

I suggested that to Xentac last night, but he told me it wouldn't work because other packages that need to install to the jre directory (such as extension modules) need to know where that directory is, whether it is jre/ or j2sdk/jre.

I don't know if this would work, but could you make the link from j2sdk to j2re a hard link instead of a symbolic link? That would behave like copying the files, but would not double up on the number of files installed. I don't remember if you can make hard links to directories though...

Another option would be this file structure

/opt/java/jre  <-- j2re gets installed here
/opt/java <-- j2sdk gets installed here; the j2re directory is now under the j2sdk directory regardless.

Dusty

Offline

#9 2004-07-01 17:34:36

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

You can make a hard link, but I'm pretty sure that wouldn't work from within a package.  Hard links point directly to inodes.  The idea is that two directory (or file) entries point to exactly the same inode.  Problem is that my inodes are different from your inodes...

If anyone wants to test this, be my guest.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#10 2004-07-01 17:48:00

sweiss
Member
Registered: 2004-02-16
Posts: 635

Re: JAVA_HOME

What if you create the hardlink using the post_install() thingy instead of within the package itself?

If this post is extremely dumb, please let me know, for I'm not too sure wether I understood the problem or not.

Offline

#11 2004-07-01 18:07:14

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

That could work... though I've always hated creating files from within a post install script wink


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#12 2004-07-01 18:42:03

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: JAVA_HOME

sweiss wrote:

What if you create the hardlink using the post_install()

That was what I was thinking.

Xentac wrote:

That could work... though I've always hated creating files from within a post install script

You can't always get what you want... do you want to not create a file in post install, or do you want the JAVA_HOME problem to go away? which is more important?

ah, decisions... decisions...

To hell with it, lets scrap J2RE and use J2SDK only! 8)

Dusty

Offline

#13 2004-07-01 19:45:06

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

My point is that I'll go with that solution if I have to, but I'd rather not, so keep suggesting things.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#14 2004-07-01 20:47:35

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: JAVA_HOME

Dusty wrote:

/opt/java/jre  <-- j2re gets installed here
/opt/java <-- j2sdk gets installed here;

Whats wrong with dusty's idea? This sounds like a viable alternative to me.


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#15 2004-07-04 00:38:38

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: JAVA_HOME

Xentac wrote:

You can make a hard link, but I'm pretty sure that wouldn't work from within a package.  Hard links point directly to inodes.  The idea is that two directory (or file) entries point to exactly the same inode.  Problem is that my inodes are different from your inodes...

If anyone wants to test this, be my guest.

I tried the hard link, but it appears that it does not work for directories. Perhaps, I missed something in the help/man files. I always get error message Operation not permitted.

I tried

ln -nF /opt/j2re /opt/j2sdk/jre

Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#16 2004-07-04 19:52:16

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

wdemoss wrote:
Dusty wrote:

/opt/java/jre  <-- j2re gets installed here
/opt/java <-- j2sdk gets installed here;

Whats wrong with dusty's idea? This sounds like a viable alternative to me.

Hmmm... I used to be against this idea because a java lib package wouldn't know where to install the libs.  But, I guess it'd always be in /opt/java/jre/...


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#17 2004-07-26 19:15:36

darose
Member
Registered: 2004-04-13
Posts: 158

Re: JAVA_HOME

I just hit this same problem.  Was there ever any solution implemented for this?

Dusty's idea sound like it would work to me too.  Any reason not to implement it?

DR

Offline

#18 2004-07-27 08:55:40

Xpop
Member
Registered: 2004-03-16
Posts: 18

Re: JAVA_HOME

I solved the problem by doing this

cd /opt/opt/j2re/lib
ln -s /opt/j2sdk/lib/tools.jar 

I don't now if there are any side effects wink

Offline

#19 2004-07-27 16:08:58

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: JAVA_HOME

Xpop wrote:

I solved the problem by doing this

cd /opt/opt/j2re/lib
ln -s /opt/j2sdk/lib/tools.jar 

I don't now if there are any side effects wink

That's more elegant than anything else that's been suggested so far. What says Xentac?

Dusty

Offline

#20 2004-07-27 18:15:36

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

What if j2sdk isn't installed?  Will it break anything because the symlink doesn't point to anything?  Or should the symlink be part of the j2sdk package?  Is it just that file that's needed and nothing else from the j2sdk package?


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#21 2004-07-27 18:44:27

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: JAVA_HOME

Xentac wrote:

What if j2sdk isn't installed?  Will it break anything because the symlink doesn't point to anything?  Or should the symlink be part of the j2sdk package?  Is it just that file that's needed and nothing else from the j2sdk package?

I'd put the symlink in the j2sdk package; apparently j2re doesn't need tools.jar, or it would have been installed there in the first place, yes/no? I don't know if that's the only needed file or not, bug reports will tell...

Dusty

Offline

#22 2004-07-28 03:33:50

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: JAVA_HOME

Dusty wrote:
Xpop wrote:

I solved the problem by doing this

cd /opt/opt/j2re/lib
ln -s /opt/j2sdk/lib/tools.jar 

I don't now if there are any side effects wink

That's more elegant than anything else that's been suggested so far. What says Xentac?

Dusty

This probably will work for solving the given problem with finding the tools.jar. But, i think the real problem is that System.getProperty("java.home") does not  return what is set as the JAVA_HOME variable, nor what is the home of the jre being executed on the path. I think it is confusing and would eventually lead to more obscure problems like this one.

I have a solution to suggest: If the problem origionally needing solved was that people were complaining about the size of the download, then don't make them depend on each other. If you would like them to be mutually exclusive because you think it would be a configuration pain , then make them confict. The argument I heard against this was that the mozilla-common plugin would break. I looked at the package build and instead of linking the library their to /opt/mozilla-common, do it in a post_install() for each of j2sdk and j2re so that both of them would basically be

post_install() {
    if [ ! -f  /opt/mozilla-common/libjavaplugin_oji.so ]; then
         ln -s /opt/j2sdk/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so /opt/mozilla-plugins
    fi

or /opt/j2jre/jre/plugin/... as applicable. If you wanted to get really crafty (and both were allowed to be installed for whatever reason) on the remove in the install script, you could check and see if the other was installed and link the library to it.

-wd


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#23 2004-07-28 04:09:11

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

I'm leaning towards the j2sdk in /opt/java and j2re in /opt/java/j2re solution.  Though I'll have to evaluate it to make sure that everything else will still work right.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#24 2004-07-28 11:52:05

wdemoss
Member
From: WV - USA
Registered: 2004-01-18
Posts: 222

Re: JAVA_HOME

Xentac wrote:

I'm leaning towards the j2sdk in /opt/java and j2re in /opt/java/j2re solution.  Though I'll have to evaluate it to make sure that everything else will still work right.

I don't mean to nit pick, but did you mean j2sdk in /opt/java nad j2re in /opt/java/jre (you said /opt/java/j2re which wouldn't work)
-wd


Hobbes : Shouldn't we read the instructions?
Calvin : Do I look like a sissy?

Offline

#25 2004-07-28 15:56:23

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: JAVA_HOME

Yeah... that's what I meant.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

Board footer

Powered by FluxBB