Need help with getting java and classpaths

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Sep 2007
Posts: 58
Reputation: Noliving is an unknown quantity at this point 
Solved Threads: 0
Noliving Noliving is offline Offline
Junior Poster in Training

Need help with getting java and classpaths

 
0
  #1
Jan 21st, 2008
Hello everyone, well its my first time ever really using java but I did do some programming in python.

Basically my first assignment is this and seems pretty easy: https://mavdisk.mnsu.edu/lct/IT214/Assignment%201.pdf

I have never done anything with class paths but it seems simple enough.

First things first, is this the correct path to get to clas path: Rightclick on mycomputer>properties>advancetab>enviromentvariables.

Currently right now this is what my classpath is showing(sidenote: I instaled java into the default installation path):

C:\Program Files\Java\jdk1.6.0_04\bin

Before I had it look like this:

C:\Program Files\Java\jre1.6.0_04\lib\ext\QTJava.zip;C:\Program Files\Java\jdk1.6.0_04\bin

Ok now moving on, if you looked at my assignment there is an editor(SciTE) that my professor recommends along with some java file/programs to download and compile and run.

When I go to compile the first file TextIO.java I get this:

>javac TextIO.java
>The system cannot find the file specified.

This leads me to believe I'm still having an issue with my classpath.

Thanks again for your guys help.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,835
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Need help with getting java and classpaths

 
0
  #2
Jan 21st, 2008
Well, there is the "path" and there is the "classpath". Normally I adjust the path first, then write a little "Hello World" program in some directory like the Desktop and save the file as "HelloWorld.java".


  1. // HelloWorld.java
  2. public class HelloWorld
  3. {
  4. public static void main (String[] args)
  5. {
  6. System.out.println("Hello World");
  7. }
  8. }


Then I go to a command line in the directory where I saved this and do the following at the command line:

javac HelloWorld.java

You should get no message whatsoever. If you do, there is something wrong with your path or you made a typo. Then type:

java HelloWorld

from the command line. That should cause your program to write "Hello World" to the console. Again, no other messages.

Neither of these commands requires the classpath but they do require the path to be adjusted properly. If you installed java without changing the path (not the classpath), that is probably your problem. I'm not saying you won't eventually need to change the classpath, but you won't for the example above.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 58
Reputation: Noliving is an unknown quantity at this point 
Solved Threads: 0
Noliving Noliving is offline Offline
Junior Poster in Training

Re: Need help with getting java and classpaths

 
0
  #3
Jan 21st, 2008
Oh I think I see it now too thanks, what I was doing wrong I was assuming in the assignment when he was saying path he was referring to class path.

I think I have it now thank you. I'll update for anyone who reads this if I solved this.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 58
Reputation: Noliving is an unknown quantity at this point 
Solved Threads: 0
Noliving Noliving is offline Offline
Junior Poster in Training

Re: Need help with getting java and classpaths

 
0
  #4
Jan 21st, 2008
Ok I solved it I was thinking of classpath and path as the samething.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC