I thoroughly checked this one, and the standard answers aren't working for me.
Whenever I try to execute a jar file from cmd prompt, instead of opening the jar file it opens a new window of Dr. Java.
I've used DrJava's "Create custom drjava jar" to create a jar file called "TestJar.jar", including:
Manifest.txt:
Main-Class: com.package.name.TestJar Class-Path: algs4.jar
TestJar.java:
public class TestJar { public static void main(String[] args) { System.out.println("Hello"); StdOut.println("hello StdOut"); } } I type this in the cmd prompt:
java -jar TestJar.jar And DrJava opens a new window. Any ideas? I've tried creating the jar file from cmd prompt but all commands I type starting with "jar" get this error:
'jar' is not recognized as an internal or external command, operable program or batch file.
Any help would be greatly appreciated...I'm pretty new to Java.
java -jar TestJar.jar TestJar. ALSO: If "jar is not recognized...", then it sounds like you need to add your Java directory to the %PATH% ;)