Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to run a java program

 
Mohnish Khiani
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whenever i have to run a java program in the command prompt i have to set the current directory to the bin folder inside the java folder's jdk folder.i also have to save my programs in the bin folder to run them.What should i do if i have to save my programs somewhere other than the bin folder in the java folder and also run these programs from command prompt.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is usually a very bad idea to save your own work inside the bin folder. When you open the command line try this (or similar)
mkdir java_work
cd java_work
Don't save anything in bin.
The next time you will only need
cd java_work
 
Campbell Ritchie
Sheriff
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and look at this FAQ.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15288
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add the bin directory of the JDK to the PATH environment variable. You can read how to do that in the JDK installation instructions, step 4 (Update the PATH variable). Note that you have to close and re-open the command prompt window after changing the variable.
 
Mohnish Khiani
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks every one..i got it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic