Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed ec2 command line tools on windows this morning. When I try to run a command ec2-describe-instances in the git bash, I get this output:

Exception in thread "main" java.lang.NoClassDefFoundError: com/amazon/aes/webservices/client/cmd/DescribeInstances
Caused by: java.lang.ClassNotFoundException: 
com.amazon.aes.webservices.client.cmd.DescribeInstances
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: com.amazon.aes.webservices.client.cmd.DescribeInstances. 
Program will exit.

But if I open up just standard cmd, everything works fine. I want to be able to use my git bash for everything. I noticed that the git bash just uses the cmd prompt but with extra options. The shortcut for the git bash has this in the target:

C:\Windows\System32\cmd.exe /c ""C:\Program Files\Git\bin\sh.exe" --login -i"

How can I get ec2 command line tools running in the git bash?

share|improve this question

4 Answers 4

I found a solution here: bash shell does not run .bat files

Run

cmd.exe '/c filename.batorexe' 

in the appropriate directory (you can't do a subfolder for some reason).

share|improve this answer
    
While this is an alternative workaround, it was not the root problem. EC2 command line tools for Windows comes with both ec2-describe-instances.cmd windows batch file as well as ec2-describe-instances bash file. –  wisbucky Dec 17 '13 at 16:26

Even in git-bash on windows you can enter into CMD mode by typing 'cmd' and then use the commands in normal cmd-way.

So, you could even try that..... this would spare you opening different consoles for different tasks.

share|improve this answer

Your problem is the class that not is found. Seems your bash shell not has access to the same environment cmd shell has. Set up the right environment and the bash shell should work.

share|improve this answer
2  
How would you go about setting up the environment? Could that be included in your answer? –  Simon Sheehan Jan 11 '12 at 20:51

The difference is that Git Bash (MINGW) doesn't convert some of the environment variables from Windows path format to *nix path format. It does the conversion for PATH, but not EC2_HOME or CLASSPATH.

I had the same error, then after setting these 2 environment variables in Git Bash, the ec2 command line worked great:

export CLASSPATH="/c/Program Files/ec2-api-tools-1.6.6.3/lib"
export EC2_HOME="/c/Program Files/ec2-api-tools-1.6.6.3"

You can add that to .bash_profile to automatically set it whenever you launch Git Bash (instead of changing the Windows environment variables), that way it will work in both Git Bash and Windows command line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.