# Azureus's Java problem

## avieth

Heres what I get when starting azureus via shell.

```

bash-2.05b# azureus

Attempting to start Azureus...

/usr/bin/azureus: line 54: java: command not found

If you recieved an error about a missing java class, you need to setup

your classpath correctly.

This should do the trick (as root):

java-config --add-system-classpath=junit,log4j,commons-cli,systray4j

env-update && source /etc/profile

Currently, your classpath (including azureus additions) is:

swt.jar:swt-pi.jar:swt-mozilla.jar:seda.jar:Azureus2.jar:.

```

What is going on here? did I forget to do something? I tried the command that says it should do the trick, it didn't work.

----------

## Lazy_Warrior

I have the same problem, my normal user has no problem, but root can't access java after a su.

If you run

```
source /etc/profile
```

root can use java, untill you su to it again. Then you have to run the command once more.

How can it be changed so I do not have to run this command to access java, when I su to root?

----------

## zerojay

I would not suggest that you run Java or any Java programs under root, as almost all the implementations of Java out there have security holes that have been acknowledged and will not be fixed.

----------

## Lazy_Warrior

In order to update azureus, you need to have root access, as far as I know.

also, I like to use portagemaster, it gives a nice overview of what is installed.

If anyone knows a better program simillar to portagemaster, I would gladly hear what it is.

Untill then, the java problem is still important I think, besides, I hate having a system that only works 99%

----------

## Epyon

I'd just let portage update azureus instead of using the built in updater.

----------

## Samui

I have the same problem with my azureus-bin.

Root can run azureus, but my normal user can't, and I don't want to run it as root.

When I try to "java-config --add-system-classpath=junit,log4j,commons-cli,systray4j" as root

, then it sais "Malformed CLASSPATH in /etc/env.d/21java-classpath".

I try to "echo "CLASSPATH=" > /etc/env.d/21java-classpath", but then it sais "jc_options: Could not find package commons-cli"

Anyone knows what should I do?

----------

## Kurgan78

Here's what I did:

NOTE: log in as your normal user account and 'su - root'. Any command following a '#' prompt is done while su'd to root.

Install SUN JRE 5.0 Update 4

-----------------------------------------

*AMD64 users will have to add "=dev-java/sun-jre-bin-1.5.0.04 ~amd64" to their /etc/portage/package.keywords file first.

*x86 users will have to add "=dev-java/sun-jre-bin-1.5.0.04 ~x86" to their /etc/portage/package.keywords file first.

```
# emerge =sun-jre-bin-1.5.0.04
```

-When you run emerge on =sun-jre-bin-1.5.0.04, you will probably get a message saying you have to fetch the files first. It should give you a URL to use. Click it, accept the license agreement, and download the correct file for your architecture. Use that to download the latest JRE binary from Sun and copy it to /usr/portage/distfiles and re-run emerge for =sun-jre-bin-1.5.0.04 as shown in the code above.

Link JRE to /usr/java

-----------------------------

```
# ln -s /opt/sun-jre-bin-1.5.0.04 /usr/java
```

Set Sun JRE as your user VM

-------------------------------------------

```
# java-config --set-user-vm=sun-jre-bin-1.5.0.04

# env-update

# source /etc/profile
```

Download, extract, and install Azureus to /opt

-----------------------------------------------------------------

-Download latest Azureus linux build from http://azureus.sourceforge.net/download.php

```
# tar -xvjf Azureus_<version>_linux.<build>.tar.bz2

# mv azureus /opt

# chmod -R 755 /opt/azureus
```

Link azureus script to /opt/bin/azureus

-------------------------------------------------------

```
# mkdir /opt/bin                 (if it doesn't already exist)

# chown root:users /opt/bin

# chmod 755 /opt/bin

# ln -s /opt/azureus/azureus /opt/bin/azureus
```

Edit the /opt/azureus/azureus script's JAVA_PROGRAM_DIR and PROGRAM_DIR variables

------------------------------------------------------------------------------------------------------------------------------

-Use your favorite editor, open /opt/azureus/azureus and edit the configuration lines as follows:

```
######## CONFIGURE ########

JAVA_PROGRAM_DIR="/usr/java/bin/"                           # use full path to java bin dir, ex. "/usr/java/j2sdk1.4.2/bin/"

PROGRAM_DIR="/opt/azureus"      # use full path to Azureus bin dir

##########i#################
```

-Make sure you uncomment both JAVA_PROGRAM_DIR and PROGRAM_DIR, as they are commented out by default.

-If you don't modify these variables in the script, Azureus will think its files are located in /opt/bin, where the script is linked to. It will also search for Java in /usr/java but for some reason won't find it. By using /usr/java/bin, Azureus will use whichever java you have linked to that path -- so if you update your JRE or change JRE's, just re-link /usr/java to /opt/<your java build>. If you want it specifically to use the Sun JRE at all times, then just put /opt/sun-jre-1.5.0.04/bin in for JAVA_PROGRAM_DIR.

Launch azureus from command line or create a program launcher

---------------------------------------------------------------------------------------------

-Simply execute "azureus" from command prompt or from your program launcher. It should work for any user on the system.

```
$ azureus &
```

-You might wish to disable the "minimize/close to system" tray options unless you're using an applet that Azureus will minimize to. It's not necessary as when you minimize or close it to the tray without having such an applet in your panel, you can just rerun azureus from command line or your launcher and it will reappear as you left it. But the system tray icon is handy to have and use. (Gnome users can just add applet "Notification Area" to their panel)

Voila. Hope it helps someone.

----------

## Samui

Oh man, I love you  :Razz:  it works perfectly.

I can't figure out what's wrong with mi e-merged azureus, I'll go on searching for information, but at least now I have a functional azureus, thanks  :Very Happy: 

EDIT: Hmpf... I've removed que manual-installed azureus-bin, emerged a ~amd64 azureus, switched to blackdown-jdk VM and it continues working well.

EDIT²: Ok. I've emerged "amd64" version of azureus-bin, 2.1.0.4, and it crashes, but the 2.3.0.4 ~amd64 version works well.

----------

## Kurgan78

I didn't have much luck with the emerged azureus-bin on my laptop and just used the .tar.bz2 file from azureus.sourceforge.net. I think I like the manual install a little better personally. At least it lets you download the latest version.  :Smile: 

I just found one more tweak you'll have to do to my Azureus setup I listed above. I just installed it on my laptop and realized that I couldn't install an update while not running azureus as root.. did this to fix it:

```
# chown -R root:users /opt/azureus

# chmod -R 775 /opt/azureus

```

Now that I think about, a better way would probably be just to create a "azureus" group and do a chown root:azureus and chmod 770 instead and then only users in the "azureus" group can run and update the program. Hmm.  :Smile: 

----------

## Kurgan78

Yep, it works  :Smile: 

Make sure to close Azureus down before you do this.

```
# groupadd -g 6881 azureus

# gpasswd -a <your_user_name> azureus

# chown -R root:azureus /opt/azureus

# chmod -R 770 /opt/azureus

```

Log out of your system and back in and it will generate your new security tokens and you'll have access. If you don't log out, you'll get some permission denied error messages.

Now only people in the azureus group can run/update azureus.

----------

## Samui

In your Azureus, installed from the package, can you see the options menu?

My merged Azureus, when I try to "Tools" --> "Options",  crashes without error message...

----------

## Slavo

in my opinion azureus is crap; it uses too much cpu , has incredibly lot of dependencies.

I use ABC client on wine  :Smile:  and it works great  :Smile: ))

----------

