Solved

java error: Could not find or load main class ButtonEncryption

Posted on 2014-01-13
8
1,184 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
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 will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now