Results 1 to 3 of 3
Thread: Help, starting with java
- 08-01-2007, 04:47 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Help, starting with java
Hi, It asks me to download java sdk.
I download it, and i receive a folder in my c:/
When i try to compile "javac" it says "javac is an invalid command"...
I was wondering if someone could just teach me how to get past this bit maybe on messenger or here...
I would even allow a remote assistance so you can do demonstrations...
I really want to learn this language....
Thanks.
- 08-01-2007, 05:17 PM #2
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
Hi there,
Don't worry. Did you set the class path to your jdk bin? If not, right click on My Computer--System Properties--Advanced--Environment Variables. Look for the CLASSPATH variable. Then go and locate your java jdk's BIN directory, copy that directory in into your classpath variable. javac should now work.
Alternatively, you can install an IDE that often does this for you. I personally use NetBeans. And i believe that it sets the path automatically? Correct me if i'm wrong, i havent done an installation of netbeans in a while.
- 08-15-2007, 08:15 AM #3
Member
- Join Date
- Aug 2007
- Posts
- 1
- Rep Power
- 0
javac manual pathing
Here is what I did to make it work.
First... here was my helloworld2.java code
__________________________________________
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
___________________________________________
I had my helloworld2.java on my desktop.
My javac app is located at: c:\program files\java\jdk1.6.0_02\bin
Here is the code I used in the command line (typed cmd in my search bar under the start menu (vista) or from "Run" in XP to get command line running)
cd.. until I was at the root of C:
C:> "\Program Files\Java\jdk1.6.0_02\bin\javac" c:\Users\Kevin\Desktop\helloworld2.java
What this line of code does is tells the computer to use the javac program, located in the \Program Files\Java\jdk1.6.0_02\bin\ directory to compile the next item, which is the java script located on my desktop. - helloworld2.java
This should work on vista
This isn't a bandaid. It is normal command line stuff. You can path it differently as stated in the last post, so the application always knows to use the javac program when called, no matter what directory tou are in.
For instance, if you type "notepad" into the command line, in any directory, the application notepad.exe will launch.
I hope this helps.Last edited by koskow; 08-15-2007 at 08:16 AM. Reason: pathing spelt wrong in title
Similar Threads
-
Indexing starting with 1
By ravian in forum New To JavaReplies: 4Last Post: 01-04-2008, 01:03 PM -
just starting
By specbailey in forum New To JavaReplies: 23Last Post: 08-14-2007, 12:25 AM
Bookmarks