> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/sdks-and-tools/universal-sdk-documentation/java/how-to-set-up-the-magtek-universal-project.md).

# How to Set Up the MagTek Universal Project

### How to Set Up the Java Library With the JRE/JVM <a href="#id-2.2_how_to_set_up_the_java_library_with" id="id-2.2_how_to_set_up_the_java_library_with"></a>

To set up and run the Java Demo software using the 32-bit version of Java on either a 32-bit or 64-bit version of Windows, follow these steps:

1. Uninstall any existing instances of the Java Runtime Environment (JRE) or Java Development Kit (JDK). Leaving them installed can cause runtime failures, as the library may fail to load.
2. Download and install the latest version of the Java Runtime Environment (JRE) and Java Development Kit (JDK).
3. [<mark style="color:red;">**Download and Set Up the MagTek Universal Java Project**</mark>](https://www.magtek.com/Content/SoftwarePackages/1000008300.zip). You may download and install it directly on the target workstation where it will be used, or you may opt to install it on a master development workstation and copy the dependencies to the target workstation manually.
4. If you opted to manually copy the MagTek Universal SDK for Java dependencies from a master development workstation to the target workstation where it will be used, follow these steps:
   1. On the master workstation, navigate to the root of the MagTek Universal SDK for Java. By default, it will be ...\x86 for 32-bit operating systems, or ...\x64 for 64-bit operating systems.
   2. Copy all the files to the target workstation’s c:\\\Windows\system32 folder for x64 systems, or to the target workstation’s C:\Windows\SysWOW64 folder for x86 systems.
5. Connect a MagTek device to the workstation. Windows will install the device drivers automatically. Wait for Windows to report the driver installation is complete.
6. Launch a Windows command prompt as an Administrator.
7. cd to the root of the folders where the MTUSDK Java Demo is installed.
8. Type test.bat and press Enter to launch the Java Demo software.

### How to Modify Manifest <a href="#id-2.3_how_to_modify_manifest" id="id-2.3_how_to_modify_manifest"></a>

The Caller-Allowable-Codebase attribute is used to identify the domains from which JavaScript code can make calls to your RIA without security prompts. Set this attribute to the domain that hosts the JavaScript code. If a call is made from JavaScript code that is not located in a domain specified by the Caller-Allowable-Codebase attribute, the call is blocked. To specify more than one domain, separate the domains by a space, for example:

{% code overflow="wrap" %}

```
Caller-Allowable-Codebase: *.yahoo.com *.google.com *.magtek.com *
```

{% endcode %}

The Application-Library-Allowable-Codebase attribute identifies the locations where your signed RIA is expected to be found. This attribute is used to determine what is listed in the Location field for the security prompt that is shown to users when the JAR file for your RIA is in a different location than the JNLP file or HTML page that starts your RIA. If the files are not in the locations identified, the RIA is blocked. Set this attribute to the domains where the JAR file, JNLP file, and HTML page are located. To specify more than one domain, separate the domains by a space, for example:

{% code overflow="wrap" %}

```
Application-Library-Allowable-Codebase: *.yahoo.com *.google.com
*.magtek.com *
```

{% endcode %}

For more information regarding the JAR File Manifest Attributes for Security, please visit this website [http<mark style="color:red;">**://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html**</mark>](http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html)

In order to modify the Manifest file, please follow these steps.

1. &#x20;Find installation folder by default, the installation folder is: ...\Library
2. Launch the command prompt and extract the META-INF/MANIFEST.MF from the jar file.

{% code overflow="wrap" %}

```
jar xf mtusdk.jar META-INF/MANIFEST.MF
```

{% endcode %}

3. Open MANIFEST.MF and look for the Caller-Allowable-Codebase and Application-Library-Allowable-Codebase and add your website URL to the list like the example above.
4. Update the manifest to the jar file.

{% code overflow="wrap" %}

```
jar umf META-INF/MANIFEST.MF mtusdk.jar
```

{% endcode %}

### How to Sign JAR <a href="#id-2.4_how_to_sign_jar" id="id-2.4_how_to_sign_jar"></a>

These instructions provide an overview of obtaining and using Sun Java signing and a digital certificate.

1. Make sure your machine has the latest Java JDK installed.
2. Generate a public/private key pair by entering the following command, specifying an alias for your keystore:

{% code overflow="wrap" %}

```
keytool -genkey -keyalg rsa -alias MyCert
```

{% endcode %}

3. Generate a certificate signing request (CSR) by entering the following command:

{% code overflow="wrap" %}

```
keytool -certreq -alias MyCert
```

{% endcode %}

After prompting you to enter the password for your keystore, keytool will generate a CSR.

4. Save the certificate received from the Certificate provider as Certname.p7b.
5. Import your Digital Certificate by entering the following command:

{% code overflow="wrap" %}

```
keytool -import -alias MyCert -file Certname.p7b
```

{% endcode %}

<p align="center">In this string, keytool is requested to import the Digital ID “Certname.cer” into the keystore MyCert. </p>

6. Bundle your applet into a Java Application Resource (JAR) file by entering the following command:

{% code overflow="wrap" %}

```
jar cvf C:\mtusdk.jar
```

{% endcode %}

7. Sign your applet by using jarsigner to sign the JAR file, using the private key you saved in your keystore:

{% code overflow="wrap" %}

```
jarsigner C:\mtusdk.jar MyCert
```

{% endcode %}

8. Verify the output of your signed JAR file by entering the following command:

{% code overflow="wrap" %}

```
jarsigner -verify -verbose -certs C:\mtusdk.jar
```

{% endcode %}

Please visit this website [<mark style="color:red;">**https://docs.oracle.com/javase/tutorial/deployment/jar/signing.html**</mark>](https://docs.oracle.com/javase/tutorial/deployment/jar/signing.html) for more information regarding signing JAR files.

### How to Set Up the SDK in Eclipse <a href="#id-2.5_how_to_set_up_the_sdk_in_eclipse" id="id-2.5_how_to_set_up_the_sdk_in_eclipse"></a>

To set up the MT Universal Java Libraries, download and install package from MagTek.com.

1. &#x20;On the master workstation, navigate to the root of the MagTek Universal SDK for Java. By default, it will be …\Library .
2. In Eclipse, click File --> New --> Java Project
3. Type the project name
4. In the library tab, click Add external jar, then point to the Lib folder of the root folder of MagTek Universal SDK for Java to add the MTUSDK.jar.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.magtek.com/sdks-and-tools/universal-sdk-documentation/java/how-to-set-up-the-magtek-universal-project.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
