Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

where is my j2sdk/bin/jar files Centos 5.9

Posted on 2014-01-15
3
Medium Priority
?
602 Views
Last Modified: 2016-03-24
Hi,

I have to run some shell program provided by Paypal for encrypting their buttons.

In the build-app2.sh program they give:

#!/bin/bash

export CRYPTO_HOME="/x/home/dhan/java_client/crypto-124"

if [ ! -d ${CRYPTO_HOME} ]; then
	echo cannot find crypto distribution ...
	return 1;
fi

CLASSPATH="."
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bcprov-jdk14-124.jar"
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bcpg-jdk14-124.jar"
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bctest-jdk14-124.jar"
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bcmail-jdk14-124.jar"
export CLASSPATH

JAVA=/x/contrib/j2sdk1.4.0/bin/java
JAVAC=/x/contrib/j2sdk1.4.0/bin/javac
JAR=/x/contrib/j2sdk1.4.0/bin/jar

echo
echo "Be sure Java version is at least 1.4"
$JAVA -version
echo ; echo ; #sleep 3


echo "CLASSPATH="
echo $CLASSPATH
echo

echo compiling java files ...
$JAVAC -g -classpath "$CLASSPATH" 	                \
	ButtonEncryption.java	\
	com/paypal/crypto/sample/*.java

echo "Done!!!!!"

Open in new window


I have to change the paths.

I'm wondering about JAVA path section:

JAVA=/x/contrib/j2sdk1.4.0/bin/java
JAVAC=/x/contrib/j2sdk1.4.0/bin/javac
JAR=/x/contrib/j2sdk1.4.0/bin/jar

Open in new window


when I login as my user and su and type:
which java
/usr/bin/java

I get this output in the bin folder:
ls -al | grep 'java'
lrwxrwxrwx  1 root root          22 Jan 13 18:21 java -> /etc/alternatives/java*
lrwxrwxrwx  1 root root          23 Jan 13 18:22 javac -> /etc/alternatives/javac*
lrwxrwxrwx  1 root root          25 Jan 13 18:22 javadoc -> /etc/alternatives/javadoc*
lrwxrwxrwx  1 root root          23 Jan 13 18:22 javah -> /etc/alternatives/javah*
lrwxrwxrwx  1 root root          23 Jan 13 18:22 javap -> /etc/alternatives/javap*

So I have to change the JAVA paths to:
JAVA=/usr/bin/java
JAVAC=/usr/bin/javac
JAR=?

But where do I find the jar files for the java sdk? I'm not quite sure even I installed the java sdk though. Still new to Java.

I'm on a VPS on Godaddy using WHM/cPanel. It's Centos 5.9.

Thank you,
Victor
0
Comment
Question by:Victor Kimura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
Mahesh Bhutkar earned 1000 total points
ID: 39784666
JAR is Java Archive tool which you will find inside your jdk folder.

Inside windows, it is located at
D:\Java\jdk1.7.0\bin\jar.exe

If you install JDK, then check out your directory,

/usr/lib/jvm/jre******/bin
/usr/lib/jvm/java-xxxxx/lib/tools.jar
0
 

Author Comment

by:Victor Kimura
ID: 39784717
Does it matter which one I use?

 [/usr/lib/jvm]# ls -al
total 36
drwxr-xr-x  3 root root  4096 Jan 13 18:22 ./
drwxr-xr-x 73 root root 28672 Jan 13 18:21 ../
lrwxrwxrwx  1 root root    26 Jan 13 18:22 java -> /etc/alternatives/java_sdk/
lrwxrwxrwx  1 root root    32 Jan 13 18:22 java-1.7.0 -> /etc/alternatives/java_sdk_1.7.0/
lrwxrwxrwx  1 root root    27 Jan 13 18:22 java-1.7.0-openjdk -> java-1.7.0-openjdk-1.7.0.25/
drwxr-xr-x  7 root root  4096 Jan 13 18:22 java-1.7.0-openjdk-1.7.0.25/
lrwxrwxrwx  1 root root    34 Jan 13 18:22 java-openjdk -> /etc/alternatives/java_sdk_openjdk/
lrwxrwxrwx  1 root root    21 Jan 13 18:21 jre -> /etc/alternatives/jre/
lrwxrwxrwx  1 root root    27 Jan 13 18:21 jre-1.7.0 -> /etc/alternatives/jre_1.7.0/
lrwxrwxrwx  1 root root    31 Jan 13 18:21 jre-1.7.0-openjdk -> java-1.7.0-openjdk-1.7.0.25/jre/
lrwxrwxrwx  1 root root    29 Jan 13 18:21 jre-openjdk -> /etc/alternatives/jre_openjdk/

There is a:
java_sdk or
 java_sdk_1.7.0 or
 java-1.7.0-openjdk-1.7.0.25
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 39785039
Java symlinks can be nightmarish. Since you seem to have java set up pretty well, try the following simplification

#!/bin/bash

export CRYPTO_HOME="/x/home/dhan/java_client/crypto-124"

if [ ! -d ${CRYPTO_HOME} ]; then
echo cannot find crypto distribution ...
return 1;
fi

CLASSPATH="."
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bcprov-jdk14-124.jar"
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bcpg-jdk14-124.jar"
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bctest-jdk14-124.jar"
CLASSPATH="$CLASSPATH:$CRYPTO_HOME/jars/bcmail-jdk14-124.jar"
export CLASSPATH

echo
echo "Be sure Java version is at least 1.4"
java -version
echo ; echo ; 


echo "CLASSPATH="
echo $CLASSPATH
echo

echo compiling java files ...
javac -g -classpath "$CLASSPATH" 	                \
ButtonEncryption.java	\
com/paypal/crypto/sample/*.java

echo "Done!!!!!"

Open in new window


Obviously the path given by $CRYPTO_HOME has to exist and all those crypto jars under it must be correct
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question