# how add environment variable in ubuntu



## mak1012 (Sep 4, 2007)

hey fols i just installed J2ee sdk in my ubuntu but i'm not able to add the environment variable in.. i referenced the sun's site it says


> Setting Environment Variables
> 
> This section shows how to set environment variables on different operating systems and shells. Each example sets the variable MYVAR to the value widget. The term "local" means that the setting is in effect only for that terminal window. "Global" means that the variable is set for all terminal windows that are subsequently launched.
> 
> ...


but in ubuntu there is no $HOME/.profile... please tell me if there is ne other way to do this..


----------



## praka123 (Sep 4, 2007)

install from ubuntu's synaptic or apt.dont go for external max possible.

```
sudo apt-get install sun-java6-plugin sun-java6-jdk
```
^^ that's all.this will keep care of those env variables.
btwn ~/.profile is ~/.bash_profile  or for the whole system /etc/profile will do.
in my debian root home dir i found a .profile file as below:

```
sid:~# cat .profile 
# ~/.profile: executed by Bourne-compatible login shells.

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi
```
^^ so avoid the hassles always search and install from synaptic or from terminal apt-get.always update package db by pressing "reload" button in synaptic or via terminal "sudo apt-get update"
get ur /etc/apt/sources.list correct if some repos are commented by a "#".
refer more @ *ubuntuguide.org


----------



## mak1012 (Sep 4, 2007)

praka123 said:
			
		

> install from ubuntu's synaptic or apt.dont go for external max possible.
> [/url]



i was trying to install but it gives me this problem i once i was installing second life but i saw it was taking 50MB...i ended the programe in between. now how can  i remove clear the uninstalled data from the catch memory?

```
mukesh@mak:~$ sudo apt-get install sun-java6-plugin sun-java6-jdk
Password:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package secondlife-install needs to be reinstalled, but I can't find an archive for it.
mukesh@mak:~$
```


----------



## vish786 (Sep 4, 2007)

mak1012 said:
			
		

> i was trying to install but it gives me this problem i once i was installing second life but i saw it was taking 50MB...i ended the programe in between. now how can i remove clear the uninstalled data from the catch memory?
> 
> ```
> mukesh@mak:~$ sudo apt-get install sun-java6-plugin sun-java6-jdk
> ...



u want to remove the package from cache folder. ??
if yes, search the package in /var/apt/cache


----------



## QwertyManiac (Sep 4, 2007)

Remove Second Life and install JDK, and then install Second Life again.


----------



## mak1012 (Sep 5, 2007)

QwertyManiac said:
			
		

> Remove Second Life and install JDK, and then install Second Life again.



i'm not able to uninstall secondlife when i open syanptic it gives me dis error

```
E: The package secondlife-install needs to be reinstalled, but I can't find an archive for it.
E: Internal error opening cache (1). Please report.
```

can i delete manually.


----------



## praka123 (Sep 5, 2007)

"sudo dpkg --purge secondlife-install"
^ does it helps?


----------



## mak1012 (Sep 5, 2007)

praka123 said:
			
		

> "sudo dpkg --purge secondlife-install"
> ^ does it helps?



i think i'm in a bad situation.... when i used "sudo dpkg --purge secondlife-install"

it says

```
mukesh@mak:~$ sudo dpkg --purge secondlife-install
Password:
dpkg: error processing secondlife-install (--purge):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 secondlife-install
mukesh@mak:~$
```

and when i tryed to install it i'gating an error this error is coming after installing secondlife.

" The package might be currupted or you are not allowed to open the file. Check the permission of the file"

but i'm the owner of the file..


----------



## praka123 (Sep 5, 2007)

```
sudo dpkg --force-remove-reinstreq  secondlife-install
```
^^try
also afterwards "sudo apt-get install -f" while internet is ON.


after trying all above commands just open System>admin>synaptic~status>to verify everything is OK.


----------



## mak1012 (Sep 6, 2007)

praka123 said:
			
		

> ```
> sudo dpkg --force-remove-reinstreq  secondlife-install
> ```



when i use above code i get this error

```
mukesh@mak:~$ sudo dpkg --force-remove-reinstreq  secondlife-install
dpkg: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Type dpkg --license for copyright license and lack of warranty (GNU GPL) [*].

Options marked [*] produce a lot of output - pipe it through `less' or `more' !
```


----------



## praka123 (Sep 6, 2007)

forgot to tell one line:

```
sudo dpkg --force-remove-reinstreq -P secondlife-install
```
^post if this works.else post the o/p from terminal for below command.

```
sudo apt-get install -f
```

do u have the file secondlife-install_1.xxxgetdeb1_i386.deb already with u?


----------



## mak1012 (Sep 6, 2007)

praka123 said:
			
		

> forgot to tell one line:
> 
> ```
> sudo dpkg --force-remove-reinstreq -P secondlife-install
> ...



thnx budy now i'll never try to install second life
yes i have.


----------



## QwertyManiac (Sep 6, 2007)

So did the Java finally get installed via APT?


----------



## praka123 (Sep 6, 2007)

dont forget to do a "sudo apt-get update" or press "reload" in synaptic manager,before try install something.


----------



## mak1012 (Sep 14, 2007)

QwertyManiac said:
			
		

> So did the Java finally get installed via APT?



yeah i succesfully installed the jdk i sun the one simple programe but i want to run servlets and jsp for that i downloaded j2ee sdk but i'm not able to start it in doc. it says to start enter this command in terminal


```
Add the install-dir/bin/ directory to the PATH environment variable.

Start the server by entering this command: asadmin start-domain domain1.
```

i added the directory path in bash.bashrc like this

```
export JAVA_HOME=/usr/java/jdk1.6.0_02
export JDK_HOME=$JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin
export PATH=$PATH:$/home/mukesh/SDK/bin
```
 when i enter this command in terminal 'asadmin start-domain domain1' it give me a error 

```
bash: asadmin: command not found
```

i'm not able to run servlet coz server is not running. please guide me...


----------



## praka123 (Sep 14, 2007)

/home/mukesh/SDK/bin/asadmin start-domain domain1
^try?
make sure PATH is shown.also export works for current session only.
see the o/p of "echo $PATH" for ur set env variables appended.
else u have to edit ~/.bashrc or some similar file to have path set for each session.
if u had installed via synaptic,shud hav been much easier.


----------



## mak1012 (Sep 17, 2007)

i tryd those not working now i dont want to waste my time in configuring ne thing.... i'll do it after my exams....till then XP.


----------



## contactpraven2001 (Sep 17, 2007)

+1 to praka from my side ............
i have the same prob ..........


----------

