• Post Reply Bookmark Topic Watch Topic
  • New Topic

I am unable to run java JDK on my computer  RSS feed

 
Sukalyan Banga
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to run java JDK on my computer
plese help me
I am attach my computer screen shot
javac.png
[Thumbnail for javac.png]
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
* Take the "\bin" off the string in JAVA_HOME
* Add this to the end of the PATH variable: ;%JAVA_HOME%\bin
* close and restart the command line
* Execute: javac -version
* you should see a version number
 
Katie Rhue
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having the same problem and I attempted Knute's solution but continued to get the same message ('javac' is not recognized...). To make sure I fully understand what you were saying, C:\Program Files\... in the screenshot was supposed to end in "jdk1.8.0_91;%JAVA_HOME%\bin" correct?

I'd never touched the environmental variables before this (didn't even know they existed and I'm not sure what they do either, just trying to be able to compile from the command prompt). I added the file path on my computer for the jdk folder containing the bin folder containing javac and gave it the variable name JAVA_HOME, hoping that following these steps would solve my problem. It didn't. I've done all my previous coding with an IDE and am trying to learn how to compile and run java files from the command prompt. Any help would be appreciated.
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Environment variables are global variables that configure your command line environment.

The JAVA_HOME environment variable is technically not need to run javac, but I recommend setting it because it makes changes to the Java environment easier.

* Confirm your JDK folder in File Explorer or any other way. Let's say it's C:\Program Files\Java\jdk1.8.0_91.
* Set your JAVA_HOME variable to that path, for instance set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_91"
* Add the Java bin folder to the PATH variable, usually at the end. For instance, if PATH ends with C:\some\path, edit PATH so that it ends C:\some\path;%JAVA_HOME%\bin
* If you have a command line window open, close it and open it again so that the environment variables will take effect.
 
Dave Tolls
Ranch Foreman
Posts: 3056
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:
* If you have a command line window open, close it and open it again so that the environment variables will take effect.


This is a common one to forget to do (and I am by no means immune to that).
It often results in cries of "but I changed it!", usually followed by "Doh!"...
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't it enough to add "C:\Program Files\Java\jdk1.8.0_91\bin" to PATH variable in System Variable? It worked for me
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is. But my way has two advantages: 1) there are programs that need JAVA_HOME and this way you remember to set it, and 2) you don't have to go searching through a possibly large PATH to find the Java version.
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:there are programs that need JAVA_HOME
Ohh, didn't know that thank you
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute Snortum wrote:. . . there are programs that need JAVA_HOME . . .
I think NetBeans is one.
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I think NetBeans is one.
I don't think so, I added just "C:\Program Files\Java\jdk1.8.0_91\bin" to PATH variable in System Variable. I have Netbeans 8.0.2. It works fine.
 
Dave Tolls
Ranch Foreman
Posts: 3056
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the Catalina batch files use JAVA_HOME. At least they used to.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously I was mistaken. Or they have changed the dependencies for NetBeans; I haven't used it for a long time.
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyway, need is the mother of invention, will come to know when need to know
 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:I think the Catalina batch files use JAVA_HOME.
Maven
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!