+ 6
How to run the java program in different folder?
I saved my java program in Local Disk D: I need to run the programs in that folder.
4 Respostas
+ 3
Any other options???
+ 1
Install a java compiler🤔
+ 1
No, if you mean to do with SoloLearn
0
simple way for beginners is run your code in Sololearn app or webpage:
https://code.sololearn.com/#java
----
or you can install some big professional java IDE like: Eclipse, IntelliJ IDEA, NetBeans
https://javatutorial.net/choose-your-java-ide-eclipse-netbeans-and-intellij-idea
----
other way is run it manualy from system:
if you have got installed java,
https://www.oracle.com/technetwork/java/javase/downloads/index.html
you need set system environment variable named: path and add path to java\bin directory to the end of this string, delimited with semicolon ; . But be careful, it is critical places.
https://java.com/en/download/help/path.xml
https://warwick.ac.uk/fac/sci/dcs/people/research/csrcbc/teaching/howto/javapath/
eg:
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
;d:\Program Files\Java\jdk-11.0.2\bin\;
Then if you type javac, system knows where find it and is able to run javac.exe compilator.
ok installation is completed
---
now how to use it:
run command line terminal, from folder where you have your SomeName.java code file.
run compiler with your code (-d .class sets where will store .class file)
javac -d .class SomeName.java
run your code, without .java after name, (-cp .class sets where is your compiled class file)
java -cp .class SomeName
you can make icon for command line and batch file for faster useful work with it.
arrow up repeats last command in terminal.