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

x
?
Solved

java error: Could not find or load main class ButtonEncryption

Posted on 2014-01-13
8
Medium Priority
?
1,253 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 664 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 668 total points
ID: 39778857
Did you compile?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 668 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 

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 36

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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

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.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
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