Java on Windows User Guide
Overview
This guide covers the deployment and use of Java on Windows Server using cloudimg AMIs from the AWS Marketplace. This AMI provides a preconfigured Windows environment with Java preinstalled, ready for developing and running Java applications.
What's included in this AMI:
- Java (JDK) preinstalled and configured in the system PATH
- Command Prompt desktop shortcut for quick access
- Windows Server with Remote Desktop access
- 24/7 cloudimg support with guaranteed 24 hour response SLA
Prerequisites
Before launching this AMI, ensure you have:
- An active AWS account
- An active subscription to the Java on Windows listing on AWS Marketplace
- An EC2 key pair for password decryption
- A Remote Desktop client application
Recommended Instance Type: t3.medium (2 vCPU, 4 GB RAM) or larger. The minimum requirements are 1 vCPU, 1 GB RAM, and 30 GB disk space.
Step 1: Launch the AMI
- Navigate to the AWS Marketplace and search for "Java Windows cloudimg"
- Click Continue to Subscribe, accept the terms, then Continue to Configuration
- Select your preferred Region and Software Version
- Click Continue to Launch
- Choose Launch through EC2 for full control over instance configuration
- Select your instance type (
t3.mediumrecommended) - Configure storage: 30 GB gp3 minimum
- Configure your Security Group with the following inbound rules:
| Port | Protocol | Source | Purpose |
|---|---|---|---|
| 3389 | TCP | Your IP | Remote Desktop (RDP) access |
- Select your EC2 key pair and launch the instance
Step 2: Retrieve the Windows Password
Wait for the EC2 instance to pass 2/2 status checks.
- Open the AWS Console and navigate to EC2 > Instances
- Select your instance
- Click Actions > Security > Get Windows password
- Click Browse and upload your EC2 key pair
.pemfile - Click Decrypt password
- Note the Username (
Administrator) and the decrypted Password
Important: It may take up to 15 minutes after launch before the Windows password is available.
Step 3: Connect via Remote Desktop
Open your Remote Desktop client:
On Windows:
1. Press Win + R, type mstsc, and press Enter
2. Enter the public IP address of your instance
3. Click Connect
On macOS: 1. Open Microsoft Remote Desktop 2. Click Add PC and enter the public IP address 3. Double click the connection to connect
When prompted:
- Username: Administrator
- Password: The decrypted value from Step 2
If a certificate warning appears, click Continue to proceed.
Step 4: Verify Java Installation
Once connected to the Windows desktop, open Command Prompt using the desktop shortcut or by pressing Win + R, typing cmd, and pressing Enter.
Verify Java is installed and accessible:
java --help
This will display the Java usage information including available options and commands. You can also check the specific version:
java -version
Using Java
Compile and run a Java program:
-
Create a file named
HelloWorld.java:cmd notepad HelloWorld.java -
Enter the following code:
java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello from cloudimg on AWS!"); } } -
Compile the program:
cmd javac HelloWorld.java -
Run the program:
cmd java HelloWorld
Run a JAR file:
java -jar your-application.jar
Check JAVA_HOME environment variable:
echo %JAVA_HOME%
Server Components
| Component | Version |
|---|---|
| Java (JDK) | Latest |
Filesystem Layout
| Drive | Description |
|---|---|
| C:\ | System drive with Windows and Java installation |
Key directories:
| Directory | Purpose |
|---|---|
| C:\Program Files\Java | Java JDK installation |
| C:\Users\Administrator | User home directory |
| C:\Users\Administrator\Documents | Default working directory |
Troubleshooting
Java command not found
- Open Command Prompt and type
java -version - Verify
JAVA_HOMEis set:echo %JAVA_HOME% - Check the PATH variable includes the Java bin directory:
echo %PATH% - If Java is not in PATH, add it manually:
cmd set PATH=%PATH%;C:\Program Files\Java\jdk-<version>\bin
Cannot connect via RDP
- Verify the instance has passed 2/2 status checks
- Check that your security group allows port 3389 from your IP
- Wait up to 15 minutes for the Windows password to be available
Out of memory errors when running Java applications
- Increase the JVM heap size:
java -Xmx4g -jar your-application.jar - Consider upgrading to a larger EC2 instance type
- Monitor memory usage in Task Manager
Security Recommendations
- Change the Administrator password after first login
- Restrict RDP access: Only allow port 3389 from your specific IP address
- Enable Windows Update: Keep the OS patched with the latest security updates
- Keep Java updated: Regularly check for and apply Java security updates
- Use strong passwords: Set a complex password for the Administrator account
- Consider a VPN: For regular access, connect through a VPN rather than exposing RDP directly
Support
If you encounter any issues with this product, contact cloudimg support:
- Email: support@cloudimg.co.uk
- Website: www.cloudimg.co.uk
- Support hours: 24/7 with guaranteed 24 hour response SLA