• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I am unable to run java JDK on my computer

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:there are programs that need JAVA_HOME

Ohh, didn't know that thank you
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the Catalina batch files use JAVA_HOME. At least they used to.
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyway, need is the mother of invention, will come to know when need to know
 
Marshal
Posts: 8856
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dave Tolls wrote:I think the Catalina batch files use JAVA_HOME.

Maven
 
Let me tell you a story about a man named Jed. He made this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic