Reply
Highlighted
Member
Posts: 6
Registered: ‎03-04-2015

newbie trying to install Java SDK on centOS Java 1.7, help!

I downloaded Authorize.net's Java SDK here

 

   https://github.com/AuthorizeNet/sdk-java

 

and I'm trying to run the examples on that webpage. So, I moved all the jar files in the `lib` folder, which are:

 

    commons-logging-1.1.1.jar*
   hamcrest-core-1.3.jar*
   hamcrest-library-1.3.jar*  
   httpclient-4.0.1.jar*
   httpcore-4.0.1.jar*
   jmock-2.6.0.jar*
   junit-4.8.2.jar*
   log4j-1.2.16.jar

 

into my GlassFish 3.1.2's folder located at: `~/glassfish3/glassfish/domains/domain1/lib/`.

 

The jar files are executables, but when I enter in the command line: `# java -jar commons-logging-1.1.1.jar` for example, it returns:

 

    no main manifest attribute, in commons-logging-1.1.1.jar

 

What am I doing wrong?

 

Note: I'm not a java expert and don't use Maven or Ant. I code using a text editor. Please keep that in mind for your answers.

Highlighted
Member
Posts: 6
Registered: ‎03-04-2015

Re: newbie trying to install Java SDK on centOS Java 1.7, help!

I finally got it built. For the benefit of other users, here's what you need to do to get Java SDK working.

 

1. copy the SDK to your server, in some temporary directory.

2. edit build.xml file and change the javac version to be that used on your server (e.g. # javac -version)

3. edit anet-java-skd.properties file and include valid numbers for your API_LOGIN_ID, and TRANSACTION_KEY. Since I'm not using MD5_HASH_KEY in my account settings, I left it blank (e.g. md5.hash.key= ), not sure if that is recommended or not.

4. copy anet-java.sdk.properties file to the user's home directory (e.g. /home/yourusername)

5. go to your temporary directory (above), and type: # ant jar

6. You should see "BUILD SUCCESSFUL".

7. Now go in the target directory that was just created, and copy all those jar files to your lib directory for the web server. In my case (GlassFish 3.1.2), the directory was ~/glassfish3/glassfish/domains/domain1/lib/.

8. Go back to the temporary directory, and copy all those dependencies into the same lib directory in step 7. The required files are: commons-logging-1.1.1.jar* hamcrest-core-1.3.jar* hamcrest-library-1.3.jar* httpclient-4.0.1.jar* httpcore-4.0.1.jar* jmock-2.6.0.jar* junit-4.8.2.jar* log4j-1.2.16.jar*

9. Restart the web server.

Now you're ready to try running the example code snippets in the SDK download git page.