![compiling java on terminal does not save work compiling java on terminal does not save work](https://i.stack.imgur.com/Tj1fZ.png)
- #COMPILING JAVA ON TERMINAL DOES NOT SAVE WORK INSTALL#
- #COMPILING JAVA ON TERMINAL DOES NOT SAVE WORK PLUS#
Well, I believe the current directory is C:\Users\MyName\java because that's what is written on the command prompt.īut when I look into this folder, I cannot find my class file!īy the way, JRE is running programs without a problem. So, where the classes are saved depends on the package defined in your java file.
![compiling java on terminal does not save work compiling java on terminal does not save work](https://i.ytimg.com/vi/LR_sDdZ0aOk/maxresdefault.jpg)
#COMPILING JAVA ON TERMINAL DOES NOT SAVE WORK PLUS#
And the location of where the classes will be placed, is the current directory, plus the subdirectories that matches the package name of your class. Well, from the way you compiled it, the classpath is the current directory. Holden Cornfield wrote:Hello, I am also a beginner to Java (and to programming as a whole). What is the problem? How do I modify where class files are saved? I have followed all of your advice until compiling withīut CLASSPATH is nowhere to be found in the list of environment variables \ system variables. So now JDK compiles my program without any problem.īut I cannot find the class file anywhere on the computer.Īnd when I try to run my program, JDK/JRE says the class cannot be found. I set the PATH variable to C:\WINDOWS\system32 C:\WINDOWS C:\Program Files\Java\jdk1.7.0_09\bin I have installed JDK onto my computer and typed up code. Hello, I am also a beginner to Java (and to programming as a whole). If that doesn't work, come back and ask againĬampbell Ritchie wrote:Welcome to JavaRanch If you have no CLASSPATH set, then Java will look in the current folder anyway. If there is anything else in the CLASSPATH, add. If you have an empty CLASSPATH, then you don't need a CLASSPATH at all. Don't put your Java bin folder in the CLASSPATH. MyFile.javaIf that works, you need to go back and edit your CLASSPATH. Write dir again at the command line, then try compiling with javac -cp. Use a text editor (preferably not NotePad, go for Jedit, Notepad++ or Notepad2 which can all be downloaded free) and save the. At present there should be nothing there. mkdir javaĭirThat will create a "java" folder where you happen to be working, move you to that "java" folder, and print its contents. If you are using Windows you will probably start in "my documents" when you open the command line.
#COMPILING JAVA ON TERMINAL DOES NOT SAVE WORK INSTALL#
If you uninstall Java to install a new version, your work will all vanish.Ĭreate a new folder. Please don't put your files in the bin folder leave that for java executables.