• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

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

 
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]
 
Sheriff
Posts: 5268
142
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
 
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: 5268
142
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.
 
Master Rancher
Posts: 3675
40
  • 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!"...
 
Ranch Hand
Posts: 529
19
Eclipse IDE Java MySQL Database 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: 5268
142
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
Eclipse IDE Java MySQL Database 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
 
Marshal
Posts: 60803
190
  • 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
Eclipse IDE Java MySQL Database 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
Master Rancher
Posts: 3675
40
  • 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: 60803
190
  • 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
Eclipse IDE Java MySQL Database 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
 
Marshal
Posts: 6102
418
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!