java error: Could not find or load main class ButtonEncryption

Posted on 2014-01-13
Last Modified: 2016-03-24

I'm trying to dynamically create Paypal buttons. They have this page:

which shows how to do this. They said to run a java command line like this:
java ButtonEncryption ./my-pubcert.pem ./name-cert2.p12 ./paypal_cert.pem mypassword InputFile OutputFile

but I get the error:
Error: Could not find or load main class ButtonEncryption

Someone suggested adding the current directory to the classpath:
shell$ export CLASSPATH=.:$CLASSPATH

But still I get the same error. I'm still learning java.

Thank you.
Question by:Victor Kimura
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

Assisted Solution

by:Mahesh Bhutkar
Mahesh Bhutkar earned 166 total points
ID: 39778577
Please check your current working directory from were you are firing a command.

Check location for class file for

Accordingly you have to modify the command.

<Links deleted as they are either StackOverflow (and irrelevant) or links to the original document that the author linked.           mccarl   --   Topic Advisor            15th Jan 2014>
LVL 12

Assisted Solution

by:Sharon Seth
Sharon Seth earned 167 total points
ID: 39778857
Did you compile?
LVL 86

Accepted Solution

CEHJ earned 167 total points
ID: 39778877
which shows how to do this.

That's only show the very end of a series of things that must be done before you can execute that app, so you're really looking in the wrong place. I'm not sure what the right place is on the Paypal site but it's covered HERE
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now


Author Comment

by:Victor Kimura
ID: 39783682
Ok, I found out there is a shell program to execute called Here's the code:

# Please source this file.

setenv PATH /x/contrib/j2sdk1.4.0/jre/bin:$PATH

setenv CRYPTO_HOME "../crypto-124"

if (-d $CRYPTO_HOME) then
	echo setting crypto home to $CRYPTO_HOME
        echo cannot find crypto distribution ...
        exit 1

setenv CLASSPATH "."
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/axis.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/jaxrpc.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/saaj.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/wsdl4j.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/commons-logging.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/commons-discovery.jar"
setenv CLASSPATH "${CLASSPATH}:${CRYPTO_HOME}/jars/bcprov-jdk14-124.jar"
setenv CLASSPATH "${CLASSPATH}:${CRYPTO_HOME}/jars/bcpg-jdk14-124.jar"
setenv CLASSPATH "${CLASSPATH}:${CRYPTO_HOME}/jars/bctest-jdk14-124.jar"
setenv CLASSPATH "${CLASSPATH}:${CRYPTO_HOME}/jars/bcmail-jdk14-124.jar"
setenv CLASSPATH "${CLASSPATH}:./ppapi.jar"

Open in new window

I have to modify the PATHs but I'm wondering what is the ${AXIS_HOME}? I just found this page:

and I think it's related to Tomcat? I'm on a VPS using WHM/cPanel. Do I need to install Tomcat then? Will it have the AXIS_HOME PATHs? I'm not familiar with Tomcat.

LVL 36

Expert Comment

ID: 39784349
Did you look at the link that CEHJ posted?

You don't have to intall Tomcat and I doubt that you would have to use that set_classpath script. Also, it was noted somewhere else in the (large number of) other questions that you have open on this one issue, that you don't need to run that Java command line that you mention on the server. It is something that you can run on any local development machine, and then you upload the resulting output file to the server.

Author Comment

by:Victor Kimura
ID: 39784691
Hi @mccarl,

Yes, I read the CEHJ posted link. I have to purchase the book (I haven't yet and read what I could from the google book link) but it may be a little outdated. I read on a stack exchange forum that the person purchased the book and tried to run it but there were problems with some outdated methods I think or some problem. So the response was that some other person modified one of the classes. But rather than using the Paypal Java SDK I'm trying to figure out (I don't know if it's simpler) how to just run the java command line option.

The buttons need to be created dynamically since the user will select options and the totals and monthly payment options will change and I have to encrypt them each time the user makes a different selection. So I was thinking of using an ajax call and exec the java command line (once I get everything set up properly) via the php shell_exec().

Been reading up a lot of pages on installing Tomcat via WHM and installing Apache Axis. I was thinking of installing Tomcat using yum rather than use WHM. My server admin friend said probably use yum. Any thoughts?

installing Apache Axis looks more complicated though but I think I can just need some .jars from the Axis as from the shell program on this line:
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/axis.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/jaxrpc.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/saaj.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/wsdl4j.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/commons-logging.jar"
setenv CLASSPATH "${CLASSPATH}:${AXIS_HOME}/lib/commons-discovery.jar"

Open in new window

should I install Tomcat via WHM or yum? What's easier or better?
LVL 86

Expert Comment

ID: 39785070
Yes, I read the CEHJ posted link. I have to purchase the book (I haven't yet and read what I could from the google book link) but it may be a little outdated.
I would not only be surprised, but worried, if Paypal's own literature (somewhere) didn't tell you all you need to know.

I would advise against getting involved in stuff that's badly documented, unless you have sufficient expertise in all related areas such that you can work it out from first principles
LVL 86

Expert Comment

ID: 39790619

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

617 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