| | |
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:
Solved Threads: 0
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.
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.
•
•
Join Date: Jan 2008
Posts: 3,835
Reputation:
Solved Threads: 503
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".
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.
Java Syntax (Toggle Plain Text)
// HelloWorld.java public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World"); } }
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.
![]() |
Similar Threads
- facing problem in database connectivity in jsp to mysql (JSP)
- non-default Java classes how to import (Java)
- jars and classpaths (Java)
- Java1 or Java2? (Java)
- Few doubts in the Java Environment (Java)
Other Threads in the Java Forum
- Previous Thread: For loop problem
- Next Thread: [B]problem accessing object(s) in vector [/B]
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application arc arguments array arrays automation binary bluetooth c++ chat class classes client code codesnippet component csv database doctype draw ebook eclipse error event exception fractal freeze game givemetehcodez graphics gui html ide image input integer intellij iphone j2me java java.xls javaprojects jmf jni jpanel julia linux list loop loops mac map method methods mobile netbeans newbie number online oracle page parameter plazmic print problem program programming project recursion reporting rotatetext scanner screen sell server set size sms socket sort sourcelabs sql string superclass swing system template test testautomation threads time title tree tutorial-sample windows working






