Solved

java error: Could not find or load main class ButtonEncryption

Posted on 2014-01-13
8
1,209 Views
Last Modified: 2016-03-24
Hi,

I'm trying to dynamically create Paypal buttons. They have this page:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/encryptedwebpayments/#id08A3I0P017Q

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

http://stackoverflow.com/questions/7485670/error-could-not-find-or-load-main-class

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

Thank you.
Victor
0
Comment
Question by:Victor Kimura
8 Comments
 
LVL 6

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 ButtonEncryption.java.

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>
0
 
LVL 12

Assisted Solution

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

Accepted Solution

by:
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
0
Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

 

Author Comment

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

#/bin/csh
# 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
else	
        echo cannot find crypto distribution ...
        exit 1
endif

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"
echo $CLASSPATH

Open in new window


I have to modify the PATHs but I'm wondering what is the ${AXIS_HOME}? I just found this page:
https://community.oracle.com/thread/1178894

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.

Thanks
0
 
LVL 35

Expert Comment

by:mccarl
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.
0
 

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 set_classpath.sh 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?
0
 
LVL 86

Expert Comment

by:CEHJ
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39790619
:)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 113
jsp login check 12 43
add projects t working set in maven 2 24
hashmap order 17 37
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

808 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