Jump to content

Cant compile java from cmd

Vulcan_Knowledge

is your %JAVA_HOME% or %JDK_HOME% on your path?

Gaming build:

CPU: i7-7700k (5.0ghz, 1.312v)

GPU(s): Asus Strix 1080ti OC (~2063mhz)

Memory: 32GB (4x8) DDR4 G.Skill TridentZ RGB 3000mhz

Motherboard: Asus Prime z270-AR

PSU: Seasonic Prime Titanium 850W

Cooler: Custom water loop (420mm rad + 360mm rad)

Case: Be quiet! Dark base pro 900 (silver)
Primary storage: Samsung 960 evo m.2 SSD (500gb)

Secondary storage: Samsung 850 evo SSD (250gb)

 

Server build:

OS: Ubuntu server 16.04 LTS (though will probably upgrade to 17.04 for better ryzen support)

CPU: Ryzen R7 1700x

Memory: Ballistix Sport LT 16GB

Motherboard: Asrock B350 m4 pro

PSU: Corsair CX550M

Cooler: Cooler master hyper 212 evo

Storage: 2TB WD Red x1, 128gb OCZ SSD for OS

Case: HAF 932 adv

 

Link to comment
Share on other sites

Link to post
Share on other sites

java is the runtime, whereas javac is the compiler.

 

Try javac HelloWorld.java,

then java HelloWorld to run

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, reniat said:

is your %JAVA_HOME% or %JDK_HOME% on your path?

It was set to the location of the bin, I changed it to %JAVA_HOME% and "java" is no longer a recognized command 

Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, Vulcan_Knowledge said:

It was set to the location of the bin, I changed it to %JAVA_HOME% and "java" is no longer a recognized command 

Run "echo %PATH%" without the quotes and tell us what it outputs.

Make sure to quote or tag me (@JoostinOnline) or I won't see your response!

PSU Tier List  |  The Real Reason Delidding Improves Temperatures"2K" does not mean 2560×1440 

Link to comment
Share on other sites

Link to post
Share on other sites

On 10/24/2018 at 7:04 PM, Vulcan_Knowledge said:

It was set to the location of the bin, I changed it to %JAVA_HOME% and "java" is no longer a recognized command 

 

You want it to be set as the location of the bin in your path. It was fine, as evidenced by the fact that the java.exe was being run, it's just that to compile you need to use javac.exe.

 

javac HelloWorld.java
java HelloWorld

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×