+ 12

How can I run java program in powershell window?

I'm trying using javac command but it gives CommandNotFound error.

24th Dec 2018, 2:09 PM
Priyanka♥️
4 Respostas
+ 3
Make sure that jre in the path. Navigate to the folder where your file is resting. Open terminal in that folder and type javac filename.java It will creates .class file in that folder And next again open terminal and type java filename That's all
24th Dec 2018, 7:42 PM
Adarsh.n. Bidari
Adarsh.n. Bidari - avatar
+ 10
Priyanka_D_Ohol try the process below: Setup environment variables in your system. set JAVA_HOME to C:\Program Files\jdk1.7 add to PATH variable the string %JAVA_HOME%\bin open new cmd session. navigate your java source folder. use javac to compile your java files. https://stackoverflow.com/questions/24464295/compiling-and-running-java-application-using-powershell I'm not a java user...😃😃😃
24th Dec 2018, 3:27 PM
Ikechukwu Okonkwo
Ikechukwu Okonkwo - avatar
+ 2
Please first check your jdk is properly installed or not
25th Dec 2018, 12:43 PM
Ayushi
Ayushi - avatar
+ 1
Adarsh's solution works to me, but not exactly. If typing "java filename", try "java classname". Per example, if the class name is "Gaba gaba", then type "java Gaba gaba", and works, well, works for me, 😁.
28th Oct 2020, 11:45 PM
Jessie Amstrong