Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

two questions about class path and running.

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
o.k., What is the class path setting I should have? My files are at C:\java(Though I don't think it matters.)My javac is at C:\jdk1.2.2\bin\javac(I usually just type it). Now when I type java SoWhatsNew"my file name". It gives the error Bad Command or Filename.How would I go about running this file? Note it is already compiled.
 
Trailboss
Posts: 23418
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to make a path to your c:\jdk1.2.2\bin and a classpath to c:\java
 
Frank Pope
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I figured out what I was doing I forgot to retype my class path when I tried to run my program. but I still haven't quite got a hold of the class path thing yet what's the dos command for setting it.its at c:\jdk1.2.2\bin I have to use the ;,; for it to work right?
[This message has been edited by Frank Pope (edited September 28, 2000).]
 
Frank Pope
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess that means I need to set my path?
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frank,
An easy way to set your path is:
Make a backup copy of your autoexec.bat file.
Open a DOS prompt.
Type " edit autoexec.bat " (without the quote marks). This will open up a program called edit (which saves files without adding .txt to the end of the file name) with your autoexec.bat file already loaded. Look for a statement in the file that starts with PATH=
If you find it, be sure you type the next statement after the existing statement.
Type " PATH=%PATH%;c:\jdk1.2.2\bin; " (again, without the quote marks)
Then go up to File on the menu and save the file.
Reboot your computer.
That will include javac in your path.
Marilyn
[This message has been edited by Marilyn deQueiroz (edited September 28, 2000).]
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Setting your CLASSPATH is done in a similar way.
Edit your autoexec.bat file so that you have a separate line that includes:
" CLASSPATH=.;C:\JAVA; " (without the quote marks). You probably don't already have a line in your file starting with "classpath", so you don't need to worry about the %CLASSPATH% part.
Marilyn
 
Frank Pope
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok like if I wanted to have three seperate paths like for my c, my java, my other. Would this work?

path=c:\windows;c:\windows\command;"c:\program files\MTS";C:\jdk1.2.2\bin\;c:\windows\c++;"c:\program files\CAD"
Huh, Huh, Have I got it???

[This message has been edited by Frank Pope (edited October 04, 2000).]
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the idea. Why are you using quote marks on some of them?
Marilyn
 
Frank Pope
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it,s got something to do with the folder names."program files"
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe it has something to do with DOS only supporting 8.3 filenames ??
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope. Totally unrelated. Besides, the 8.3 limitation went out with Windows95 (DOS 7.0).
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Path is a enviornament variable the
machine knows that such a command like java ,
or javac,javah,javaw have some meaning and must
be executed .
whereas classpath tells the compiler where to load the class
files from. u can avoid using classpath if u use javac -d command.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the best way to compile and run java examples on Windows is to put your .java files into a directory, do
javac *.java
then to run, go to that subdir and type
javac -classpath . YourClassFile
 
paul wheaton
Trailboss
Posts: 23418
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"pbhaggood",
Take a look at this
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic