Reputation: 475
I got tired of using Eclipse because it was too "plain" and "old style". So I moved on to a program called Sublime Text 3 and I used a package named "material theme" which made the program look flat and all nice and stuff.
But I wanted to code Java in that but I don't know how to compile stuff without using an IDE and it was not easy to find out but I found out that you could do it through the terminal/cmd of your operating system.
But what I don't understand is how I could actually use the javac
command which means Java Compile and I searched and I didn't find out because I couldn't understand anything that was posted on either YouTube or Stack Overflow because I'm new to this whole terminal/cmd Java Compiling thing.
Upvotes: 6
Views: 56312
Reputation: 3843
Install JDK
(Make sure your PATH variable is set up)
Use SublimeText's Build System, which allows you to compile open java
documents with the Ctrl + B command.
Upvotes: 1
Reputation: 418
You're almost there buddy!
Just be sure you have the Java Development Kit (JDK)
installed in your system. The JDK provides you the command javac
-which you need to compile your .java
program files.
The javac
command is not that friendly as you think it is. You have to let it know where to find the java file you want to compile.
For example you saved Main.java
inside C:\Projects\Java
you must compile it this way javac C:\Projects\Java\Main.java
.
Then you can run your program this way too java C:\Projects\Java\Main
As mentioned here... You can find a more detailed explanation to the official tutorial.
Upvotes: 11
Reputation: 92
You need to install java JDK which you can find here
Then you need to right-click on my computer->properties->advanced system settings->Environment variables -> Click on path -> New
Then add the path to the bin folder inside the install folder for JDK.
Then in cmd you can compile with
javac *.java
inside the directory of your code
Upvotes: 1
Reputation: 18792
You did not install JDK. You need to install JDK which has javac command.
Installing JDK on MAC instructions
Installing JDK on Windows instructions
After installing JDK(Java Development Kit), you can run the command javac -version
on command line and let it show the version that is installed.
Upvotes: 0