Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Trouble running first application  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried to follow the directions for running the HelloWorldApp, but seem to be doing something wrong somewhere.

I create the text file using Notepad, saving it as "HelloWorldApp.java".

I then change the current directory in the Command Prompt to the file containing HelloWorldApp.java by typing "cd c:\Java Practice" (without the quotes). This seems to work.

I then try to compile the code by typing "javac HelloWorldApp.java" to the command line (again, without the quotes), and get the following error: 'javac' is not recognized as an internal or external command, operable program or batch file.

I have a j2sdk1.4.2_12 folder directly on my C drive with the bin and jre files inside that. The bin folder contains the executable, javac.exe. I think I haven't told the Command Prompt where javac is located some how, but don't know the missing step.

Apologies for the low level of the question. Have just been banging my head against the computer for a day now...
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
5. Update the PATH variable

http://java.sun.com/j2se/1.5.0/install-windows.html

(this is for 1.5, but the procedure is the same for 1.4.2)
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should configure your system variables.

in windows:
start >> Settings >> Control Panel >> System >> Advanced >> Environment Variables

Search for variable 'Path' than add (using ';' as separator):
C:\folder_where_you_install_jdk\bin (e.g C:\j2sdk1.4.2_12\bin)

Add new variable JAVA_HOME and as value:
C:\folder_where_you_install_jdk (e.g C:\j2sdk1.4.2_12)

(you can skip this step, it's just for checking: start >> run >> type 'cmd' without quote >> and type 'java -version' without quote. If you get something like "java version 1.4.2_12 blablabla" than you have done right with your system variables)

Back to the system variables:
Add new variable CLASSPATH and as value:
your_project_path (in your case the folder path where you saved HelloWorldApp.java)
 
Brendon Gehring
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Satou for the great link. It provides a lot of great information.

And thank you Sanjaya for the very clear, step by step directions. They really made it easy, and all worked as advertised.
 
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!