PDA

View Full Version : JDK 6 tools



LoneCipher
2nd March 2009, 06:18 PM
I'll start by saying i have a small amount of experience in Linux, and no experience in Java.

I'm trying to get my laptop setup for programming using Eclipse. My intention is to play with the Android SDK. I ran through thier setup notes at http://code.google.com/android/intro/installing.html . Everything appears to be working and my Hello World app ran in the emulator sucessfully :D.
The next step was to sign the .apk with a certificate. The process dosent seem to be hard, but it does require the use of 2 command line tools. The tools are "keytool" and "jarsigner". Keytool seems present at the command line. Typing keytool gives me a list of options. jarsigner however is not present. From what information i found, keytool may be part of the gnu compiler that was preinstalled on linux. This is not compatible with the Android sdk.
I installed jdk-6u12-linux-i586.bin from sun's site (https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter).

When walking through the Android install notes iI did skip the optional step to edit my ~/.bash_profile or ~/.bashrc file.

My question:
Why cant i use jarsigner at the command line?
Am i using the proper version of Keytool?

cable_txg
2nd March 2009, 06:34 PM
Try searching for jarsigner:

find / -name "jarsigner"

When found, edit your PATH in your bashrc file:

PATH=%PATH:<Path to jarsigner>

Replace <Path to jarsigner> with the actual path name the find command gives you.

LoneCipher
2nd March 2009, 06:51 PM
Thank you for the fast response.


The path to Jarsigner was "/usr/java/jdk1.6.0_12/bin"

The portion of bashrc that contains refrences to path is


"profile
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# Only display echos from profile.d scripts if we are no login shell
# and interactive - for noninteractive just process them to set envvars
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
if [ "$PS1" ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done

unset i
unset pathmunge"



If i had to guess it would look like this:

" if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:/usr/java/jdk1.6.0_12/bin
else
PATH=$1:$PATH
fi
fi"

Im pretty new to Fedora and i have a vauge idea of what bashrc actually does.

LoneCipher
2nd March 2009, 07:14 PM
I made the above change and jarsigner dosent appear to be a usable command as root. I must have missed a step. Should the command be usable after making the above change?

cable_txg
2nd March 2009, 07:34 PM
Do this:

vi .bash_profile

edit the line that says PATH and insert your path to jarsigner at end like so:

PATH=/usr/local/Trolltech/Qt-4.4.3/bin:$PATH:.:<Path to jarsigner>

export PATH


logout and login once more....

LoneCipher
2nd March 2009, 08:08 PM
You are the best! It's working now. And best of all i learned a bit more about the workings of fedora.

I will mail you e-cookies :p

cable_txg
2nd March 2009, 08:17 PM
You are the best! It's working now. And best of all i learned a bit more about the workings of fedora.

I will mail you e-cookies :p

:D Make that ten boxes :D

cable_txg
2nd March 2009, 08:17 PM
Don't forget to inform group it's been solved so Admins could close this.

LoneCipher
2nd March 2009, 08:34 PM
keke. How do i do that?

measekite
2nd March 2009, 09:49 PM
I'll start by saying i have a small amount of experience in Linux, and no experience in Java.

I'm trying to get my laptop setup for programming using Eclipse. ...

Why did you choose Eclipse over NetBeans or some other IDE? Just curious?

LoneCipher
3rd March 2009, 03:02 PM
Google talked up eclipse and said it was an easy way to work with the sdk. I'm not familiar with any type of enviroment.
What would you recommend?

measekite
4th March 2009, 02:50 AM
Google talked up eclipse and said it was an easy way to work with the sdk. I'm not familiar with any type of enviroment.
What would you recommend?

That is what I am trying to determine. I have a few requirements:

It must be good for easy prototyping for small departmental applications that pay $$.

I need to like it.

It has to be accepted in the business world.

It has to be easy.

It has to have staying power.

It needs to be a quick study.

It has to run under Linux.

Cross Platform would be a plus but not a necessity.

marcrblevins
4th March 2009, 03:48 AM
I never had to change my PATH for JDK. I use alternatives --install thingy.

Such as if my memory is correct, had to do this for Oracle SQL Developer requirement:


su -
alternatives --install /usr/bin/java java /usr/java/jdk1.5.0_17/jre/bin/java

Then I tested it:


[marc@kiriyamablevins ~]$ alternatives --config java

There are 4 programs which provide 'java'.

Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3 /usr/java/jre1.6.0_07/bin/java
+ 4 /usr/java/jdk1.5.0_17/jre/bin/java

Enter to keep the current selection[+], or type selection number:
[marc@kiriyamablevins ~]$ java -version
java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)
[marc@kiriyamablevins ~]$