Solved

java error: Could not find or load main class ButtonEncryption

Posted on 2014-01-13
8
1,221 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
[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
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Problem to Alipay 10 94
Netbeans and org.apache.commons.lang3 issue 3 53
Bitwise and to sum elements 2 52
Overriding a method 3 12
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses

734 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