Results 1 to 9 of 9
- 07-30-2008, 05:38 AM #1
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
[SOLVED] Can't change JDK directory.
Hello All,
I just started a Java class... and very glad I found this forum.
I installed JDK and everything that needed to be installed...
I also tried to run jGRASP, but have been having difficulties getting it running.
When I load a program in jGrasp, and try to compile it, this is what I get.
----jGRASP exec: javac -g F:\SOURCECODE\Chapter 01\Payroll.java
----jGRASP wedge2 error: command "javac" not found.
---- This command must be in the current working directory
---- or on the current PATH to use this function.
---- PATH is ";C:\Windows\system32;C:\Windows\system32;C:\Windo ws;C:\Windows\System32\Wbem;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\".
----
---- Make sure you have the full JDK (J2SE SDK or other), not just the JRE, installed.
---- The J2SE SDK is available from java.sun.com.
----jGRASP: operation complete.
What frustrates me, is I cannot figure out where in the jGrasp program that i need to configure to the JDK directory.
JDK is installed in:
C:\Program Files\Java\jdk1.6.0_10
.........
after getting frustrated with this, i installed NetBeans.
And me being brand new to programming, there was too many things going on. jGrasp seemed simpler when we used it in class.
Thank you very much in advance for your help.
- 07-30-2008, 08:36 AM #2
Senior Member
- Join Date
- May 2008
- Location
- Makati, Philippines
- Posts
- 234
- Rep Power
- 6
in ur environment variables.
Control Panel --> System
In Advanced Tab click the Environment Variables Button
set the following
click new in the user variables
then click new againJava Code:name: java_home value: C:\Program Files\Java
Java Code:name: PATH value: %PATH%; C:\Program Files\Java\jdk1.6.0_10\bin
Mind only knows what lies near the heart, it alone sees the depth of the soul.
- 07-30-2008, 08:42 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Then type javac on the command prompt and see what's the output is. There you get the all javac compiler possible options, if you set the class path correctly.
- 07-30-2008, 11:42 AM #4
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
I did exactly as told, and I still get the same error in jGrasp.
So I tried with NetBeans.
This is the error I get.
init:
deps-jar:
Compiling 1 source file to C:\Users\duran\Desktop\payroll\build\classes
C:\Users\duran\Desktop\payroll\src\payroll\Main.ja va:1: class Payroll is public, should be declared in a file named Payroll.java
public class Payroll
1 error
BUILD FAILED (total time: 0 seconds)
----
netbeans, not too excited about using that.
I just want to get jGrasp going to input simple programs to understand java better, but am having so much difficulty.
Eranga... I typed in javac in CMD propt, and nothing happened. Says it is not recognized as an internal or external command...
Im sorry if my questions are really beginner and frustrating, but I really have to get started on this. So I need help.
Thanks in advance.
- 07-30-2008, 11:45 AM #5
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
- 07-30-2008, 12:12 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 07-30-2008, 12:17 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This is because you class name and the file name is not same. Your file name is Main, but the class name is Payroll. So change one of them and set both of them to same.
That means, the settings on the class path is still not correct. Since environment variables are wrong, your system can't find the javac as a valid program.
- 07-30-2008, 01:42 PM #8
Member
- Join Date
- Jul 2008
- Posts
- 7
- Rep Power
- 0
Finally got the compiler to work. I had to change information in SYSTEM VARIABLES.
----
I also had to take %path% out from
"name: PATH
value: %PATH%; C:\Program Files\Java\jdk1.6.0_10\bin"
It wouldn't work with %path%; being in there.
I really appreciate all the help. Extremely friendly and helpful community here.
Thank you all,
- 07-31-2008, 06:02 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Nice to here that. If you solve the problem please mark the thread as solved.
Similar Threads
-
How can I change a project's build directory?
By sylvpan in forum NetBeansReplies: 11Last Post: 02-03-2011, 06:18 AM -
How to change JDK?
By mew in forum EclipseReplies: 5Last Post: 05-21-2010, 05:21 AM -
How ro change the locale of JVM
By ravi.ks007@hotmail.com in forum Advanced JavaReplies: 2Last Post: 12-26-2007, 06:17 AM -
Change my for loop
By javaplus in forum New To JavaReplies: 4Last Post: 12-12-2007, 11:00 AM -
Is it possible to change the '\n' into ' ' ...
By johnny7white in forum New To JavaReplies: 1Last Post: 11-15-2007, 02:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks