FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 08-17-2012, 09:52 AM
Markus Schönhaber
 
Default JAVA_HOME

17.08.2012 11:14, Thufir:

> What's the deal, haven't I set JAVA_HOME correctly?

Doesn't matter, as long...

> thufir@dur:~$
> thufir@dur:~$ sudo Desktop/james-2.3.2/bin/run.sh
> ERROR: JAVA_HOME not found in your environment.
>
> Please, set the JAVA_HOME variable in your environment to match the
> location of the Java Virtual Machine you want to use.

...as you use sudo this way, where by default the environment gets reset.

--
Regards
mks


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-17-2012, 03:14 PM
Colin Law
 
Default JAVA_HOME

On 17 August 2012 10:14, Thufir <hawat.thufir@gmail.com> wrote:
> What's the deal, haven't I set JAVA_HOME correctly?
>
> thufir@dur:~$
> thufir@dur:~$ sudo Desktop/james-2.3.2/bin/run.sh
> ERROR: JAVA_HOME not found in your environment.
>
> Please, set the JAVA_HOME variable in your environment to match the
> location of the Java Virtual Machine you want to use.
> thufir@dur:~$
> thufir@dur:~$ echo $JAVA_HOME

Try sudo echo $JAVA_HOME

Colin

> /usr/lib/jvm/java-6-openjdk-common
> thufir@dur:~$
> thufir@dur:~$ ll /usr/lib/jvm/
> total 104
> drwxr-xr-x 6 root root 4096 Aug 16 00:41 ./
> drwxr-xr-x 242 root root 73728 Aug 16 23:55 ../
> lrwxrwxrwx 1 root root 19 Apr 12 18:57 java-1.6.0-openjdk-i386 ->
> java-6-openjdk-i386/
> -rw-r--r-- 1 root root 2345 Apr 12 18:57 .java-1.6.0-openjdk-i386.jinfo
> drwxr-xr-x 3 root root 4096 Aug 16 00:41 java-6-openjdk-common/
> drwxr-xr-x 5 root root 4096 Aug 16 00:41 java-6-openjdk-i386/
> drwxr-xr-x 5 root root 4096 Aug 16 00:41 java-7-openjdk-i386/
> drwxr-xr-x 8 root root 4096 Aug 14 11:14 java-7-oracle/
> -rw-r--r-- 1 root root 2564 Aug 14 11:14 .java-7-oracle.jinfo
> thufir@dur:~$
> thufir@dur:~$ sudo update-alternatives --config java
> There are 3 choices for the alternative java (providing /usr/bin/java).
>
> Selection Path Priority
> Status
> ------------------------------------------------------------
> 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1063
> auto mode
> * 1 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061
> manual mode
> 2 /usr/lib/jvm/java-7-oracle/bin/java 1062
> manual mode
> 3 /usr/lib/jvm/java-7-oracle/jre/bin/java 1063
> manual mode
>
> Press enter to keep the current choice[*], or type selection number:
> thufir@dur:~$
> thufir@dur:~$ java -version
> java version "1.6.0_24"
> OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
> OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
> thufir@dur:~$
>
>
>
> see:
>
> http://askubuntu.com/questions/175514/how-to-set-java-home-for-openjdk
>
>
>
> thanks,
>
> Thufir
>
>
> --
> ubuntu-users mailing list
> ubuntu-users@lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-17-2012, 03:39 PM
Markus Schönhaber
 
Default JAVA_HOME

17.08.2012 17:14, Colin Law:

> On 17 August 2012 10:14, Thufir <hawat.thufir@gmail.com> wrote:
>> What's the deal, haven't I set JAVA_HOME correctly?
>>
>> thufir@dur:~$
>> thufir@dur:~$ sudo Desktop/james-2.3.2/bin/run.sh
>> ERROR: JAVA_HOME not found in your environment.
>>
>> Please, set the JAVA_HOME variable in your environment to match the
>> location of the Java Virtual Machine you want to use.
>> thufir@dur:~$
>> thufir@dur:~$ echo $JAVA_HOME
>
> Try sudo echo $JAVA_HOME

Why?
That will show the same as
echo $JAVA_HOME
since bash will apply variable expansion before it calls sudo.

--
Regards
mks



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-17-2012, 04:07 PM
Colin Law
 
Default JAVA_HOME

On 17 August 2012 16:39, Markus Schönhaber
<ubuntu-users@list-post.mks-mail.de> wrote:
> 17.08.2012 17:14, Colin Law:
>
>> On 17 August 2012 10:14, Thufir <hawat.thufir@gmail.com> wrote:
>>> What's the deal, haven't I set JAVA_HOME correctly?
>>>
>>> thufir@dur:~$
>>> thufir@dur:~$ sudo Desktop/james-2.3.2/bin/run.sh
>>> ERROR: JAVA_HOME not found in your environment.
>>>
>>> Please, set the JAVA_HOME variable in your environment to match the
>>> location of the Java Virtual Machine you want to use.
>>> thufir@dur:~$
>>> thufir@dur:~$ echo $JAVA_HOME
>>
>> Try sudo echo $JAVA_HOME
>
> Why?

Because then you will learn a lot because someone will point out how
stupid you are to even try that.

To the OP,
sudo sh -c 'echo $JAVA_HOME'
might be more informative. Or am I still being stupid?

Colin

> That will show the same as
> echo $JAVA_HOME
> since bash will apply variable expansion before it calls sudo.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-18-2012, 04:33 PM
Thufir
 
Default JAVA_HOME

On Fri, 17 Aug 2012 17:07:21 +0100, Colin Law wrote:

> To the OP,
> sudo sh -c 'echo $JAVA_HOME'
> might be more informative.


thufir@dur:~$
thufir@dur:~$ ls /usr/lib/jvm/java-6-openjdk-common
jre
thufir@dur:~$ sudo sh -c 'echo $JAVA_HOME'
[sudo] password for thufir:

thufir@dur:~$
thufir@dur:~$ sudo sh -c 'echo $JAVA_HOME'

thufir@dur:~$
thufir@dur:~$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/
games"
JAVA_HOME="/usr/lib/jvm/java-6-openjdk-common"
thufir@dur:~$



thanks,

Thufir


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-18-2012, 07:26 PM
Colin Law
 
Default JAVA_HOME

On 18 August 2012 17:33, Thufir <hawat.thufir@gmail.com> wrote:
> On Fri, 17 Aug 2012 17:07:21 +0100, Colin Law wrote:
>
>> To the OP,
>> sudo sh -c 'echo $JAVA_HOME'
>> might be more informative.
>
>
> thufir@dur:~$
> thufir@dur:~$ ls /usr/lib/jvm/java-6-openjdk-common
> jre
> thufir@dur:~$ sudo sh -c 'echo $JAVA_HOME'
> [sudo] password for thufir:
>
> thufir@dur:~$
> thufir@dur:~$ sudo sh -c 'echo $JAVA_HOME'
>
> thufir@dur:~$
> thufir@dur:~$ cat /etc/environment
> PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/
> games"
> JAVA_HOME="/usr/lib/jvm/java-6-openjdk-common"
> thufir@dur:~$

Are you ok now or do you not see what the issue is? When you use sudo
you get root's environment not the current user. You could use sudo
su instead, which gives you root privileges but the users environment
(I think).

Colin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 08-18-2012, 09:24 PM
Thufir
 
Default JAVA_HOME

On Sat, 18 Aug 2012 20:26:43 +0100, Colin Law wrote:

> Are you ok now or do you not see what the issue is? When you use sudo
> you get root's environment not the current user. You could use sudo su
> instead, which gives you root privileges but the users environment (I
> think).


I found that "sudo su -" gives me root, and I'm able to echo $JAVA_HOME.
However, what should it be set to? It seems to be asking for a binary.


root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin# ./james-cli.sh -h
localhost -p 9999 adddomain mydomain.tld
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/java-6-openjdk-common/bin/java
root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin# echo $JAVA_HOME/usr/lib/
jvm/java-6-openjdk-common
root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin# ll /usr/lib/jvm/
total 104
drwxr-xr-x 6 root root 4096 Aug 16 00:41 ./
drwxr-xr-x 226 root root 73728 Aug 18 10:24 ../
lrwxrwxrwx 1 root root 19 Apr 12 18:57 java-1.6.0-openjdk-i386 ->
java-6-openjdk-i386/
-rw-r--r-- 1 root root 2345 Apr 12 18:57 .java-1.6.0-openjdk-i386.jinfo
drwxr-xr-x 3 root root 4096 Aug 16 00:41 java-6-openjdk-common/
drwxr-xr-x 5 root root 4096 Aug 16 00:41 java-6-openjdk-i386/
drwxr-xr-x 5 root root 4096 Aug 16 00:41 java-7-openjdk-i386/
drwxr-xr-x 8 root root 4096 Aug 14 11:14 java-7-oracle/
-rw-r--r-- 1 root root 2564 Aug 14 11:14 .java-7-oracle.jinfo
root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin# ll /usr/lib/jvm/java-6-
openjdk-common/jre/lib
total 6352
drwxr-xr-x 6 root root 4096 Aug 16 00:41 ./
drwxr-xr-x 3 root root 4096 Aug 16 00:41 ../
-rw-r--r-- 1 root root 3534509 Apr 12 18:22 charsets.jar
-rw-r--r-- 1 root root 78288 Apr 12 18:15 classlist
drwxr-xr-x 2 root root 4096 Aug 16 00:41 cmm/
-rw-r--r-- 1 root root 1450 Apr 12 18:14 compilefontconfig.jar
-rw-r--r-- 1 root root 4049 Apr 12 18:16 currency.data
drwxr-xr-x 2 root root 4096 Aug 16 00:41 ext/
drwxr-xr-x 2 root root 4096 Aug 16 00:41 im/
drwxr-xr-x 3 root root 4096 Aug 16 00:41 images/
-rw-r--r-- 1 root root 42111 Apr 12 18:15 javazic.jar
-rw-r--r-- 1 root root 85261 Apr 12 18:21 jce.jar
-rw-r--r-- 1 root root 523793 Apr 12 18:29 jsse.jar
-rw-r--r-- 1 root root 4226 Apr 12 18:16 jvm.hprof.txt
-rw-r--r-- 1 root root 385 Apr 12 18:21 management-agent.jar
-rw-r--r-- 1 root root 1053728 Apr 12 18:29 resources.jar
-rw-r--r-- 1 root root 1127950 Apr 12 18:29 rhino.jar
root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin# ll /usr/bin/java
lrwxrwxrwx 1 root root 22 Aug 14 11:14 /usr/bin/java -> /etc/alternatives/
java*
root@dur:/home/thufir/apache-james-3.0-beta4/bin#
root@dur:/home/thufir/apache-james-3.0-beta4/bin# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
root@dur:/home/thufir/apache-james-3.0-beta4/bin#




thanks,

Thufir


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:33 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org