jar - how to run java file in window powershell -
jar - how to run java file in window powershell -
i know there similar questions out there none of solutions work case. tried execute java file using windows powershell.
this have java file:
public class demo1 { public static void main (string arg[]){ system.out.println("demo1 start running"); seek { thread.sleep(4000); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); system.out.println("unable process"); } system.out.println("demo1 java completed."); } }
for easy compilation, have copies of demo1.java, demo1.jar, , demo1.class in desktop directory.
for powershell command, have tried: 1st attempt: c:..\desktop> java demo1.java
2nd attempt: c:..\desktop> java -class demo1.class
3rd attempt: c:..\desktop> java -jar demo1.jar
all above effort homecoming error: ps c:\users\b003485\desktop> java .\demo1.java exception in thread "main" java.lang.noclassdeffounderror: /\demo1/java caused by: java.lang.classnotfoundexception: .\demo1.java @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) not find main class: .\demo1.java. programme exit.
java jar window powershell-v3.0
Comments
Post a Comment