|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (11 bit)
Join Date: Aug 2003
Location: Silicon Valley
Posts: 1,512
|
getting java to work on my machine
im taking a computer science course based on java programming. i downloaded the java 2 developers kit from sun microsystems website, and installed.
Dont know enough about this yet to know why its not working--at school in the DOS prompt we type something like: "javac (name of program)" on my machine in dos anything i type with javac says its an invalid command...little help anyone?? EDIT: I've found a javac file in my program files/java. but i just plain can't use it from dos. anyone know how to do this?
__________________
Desktop: Intel Core i7 930 @ 4.0 GHz | Sapphire HD 6850 | Asus P6X58D Premium | Vertex 2 120GB | 12GB OCZ DDR3 | Notebook: 13" Macbook Pro | 2.26GHz C2D | 4GB Mushkin DDR3 | Nvidia 9400M | 500GB Scorpio Blue | OS X Lion | File Server: Intel Atom N330 | Zotac ION G-E | 4GB Corsair XMS2 | 3 x 2TB Caviar Green | Last edited by inflames988; 09-10-2005 at 09:12 PM. |
|
|
|
|
|
#2 |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
You need to change the directory to the java bin directory where the javac.exe file resides, then execute the command.
For example, for Java SDK version 1.4.2 revision 6, the directory could be either C:\j2sdk1.4.2_06\bin C:\program files\j2sdk1.4.2_06\bin Try doing a file search for javac.exe to locate the directory. That will probably be faster if those two examples weren't it.
__________________
There are two secrets to staying young, being happy, and achieving success. You have to laugh and find humor every day, and you have to have a dream.
|
|
|
|
|
|
#3 |
|
Member (11 bit)
Join Date: Aug 2003
Location: Silicon Valley
Posts: 1,512
|
thanks FF. you're answering my questions all over the place. now i can compile, and i found a website that told me how to change add PATHs under system in my comptuer, something about environment or something. so now i can compile/do those other commands from any directory, BUT, i cant run anything. example
C:\APCS> java ___ Exception in thread "main" java.lang.NoClassDefFoundError: _______ where ___s are the name of the program. I DID compile them though..? EDIT: the compiled progs are set by defualt to open with abiword (open source word processor) and are supposedly MS-DOS files, they dont say CLASS file though...? |
|
|
|
|
|
#4 |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
You need to run the main .class file, not the .java file. The .java file is just plain text and uncompiled. The .class file is the compiled, runnable file.
|
|
|
|
|
|
#5 |
|
Member (11 bit)
Join Date: Aug 2003
Location: Silicon Valley
Posts: 1,512
|
yea i know that...at school once u compile the .class file, all u do is type java ___ which is the name of the file, to run it
|
|
|
|
|
|
#6 |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
Ok, could you explain a bit more what the problem is? I'm not quite sure what you're trying to do.
|
|
|
|
|
|
#7 |
|
Member (11 bit)
Join Date: Aug 2003
Location: Silicon Valley
Posts: 1,512
|
Im taking a class on java programming. So i tried installing JDK at home. After changing the paths to allow me to compile, i canot RUN the programs in dos. for example
Hello.java is a basic text program that displays text. I compile it in command by typing: javac Hello.java Then i attempt to run it by typing: java Hello and it SHOULD run this type of program in dos (thus displaying the text.) but it gives me that error message. EDIT: figured it out force. stupid mistake on my part, can understand now why u didnt know what i was asking...sry but im reallll new to this stuff. hopefully now that javas working on my machine i can learn a little better. I was using a shortcut to command instead of start/run/CMD which was the problem. didnt know exactly what the difference was but it works in CMD. Last edited by inflames988; 09-13-2005 at 10:19 PM. |
|
|
|
|
|
#8 |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
Don't worry about it, we all gotta start somewhere.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|