Joined: Wed Dec 08, 2010 12:32 pm Posts: 6 Has thanked: 0 time Have thanks: 0 time
I feel good to know that many have similar names as that of mine..i used to thought that it is kind of least common name.... well thanks...now i have finally finished re-installing.
now too i m unable to set the permanent path of java... i already have tried setting a path in environment variables but it still its not working so i have to set the path to bin again and again for compilation purposes...
1 more query i was running a small program and getting an error in that too... Can u help the program is--
Code:
public class myanimallist { private animal[] animals = new animal[5]; private int nextindex = 0;
public void add(animal a) { if(nextindex < animals.length) { animals[nextindex] = a; System.out.print("animal added at " + nextindex); nextindex++; } }
}
public class animal { public static void main(String[] args) { myanimallist list = new myanimallist();
dog d = new dog();
cat c = new cat(); list.add(d); list.add(c); } }
As i m trying to understand the polymorphism in java but i m getting 4 errors in animal class after compilation that too related with dog and cat objects or reference variables or whatsoever....
rpbarbati
Question subject: Re: Java error
Posted: Fri Jan 07, 2011 1:20 am
Joined: Fri Jan 07, 2011 1:13 am Posts: 2 Has thanked: 0 time Have thanks: 0 time
You must set your JAVA_HOME variable and add it to your Path.http://www.codemiles.com/posting.php?mode=reply&f=20&sid=684d69fda86e359d58e0acfd2e146819&t=6941#
Right click on My Computer, select Properties. Select Advanced. Click on the Environment Variables button. Add a new system variable. Name it JAVA_HOME. Its value should be the path to the top of the Java install. C:\program files\java or the equivalent.
Now edit the Path variable and add the following to the end - ;%JAVA_HOME%\bin
Save the changes. Start a command window (Start:Run:cmd:enter) or Programs:Accessories:DOS command window). Type java -version and press enter. If you get bad command or filename, you did not set the JAVA_HOME correctly.
rpbarbati
Question subject: Re: Java error
Posted: Fri Jan 07, 2011 1:23 am
Joined: Fri Jan 07, 2011 1:13 am Posts: 2 Has thanked: 0 time Have thanks: 0 time
You must set your JAVA_HOME variable and add it to your Path.
Right click on My Computer, select Properties. Select Advanced. Click on the Environment Variables button. Add a new system variable. Name it JAVA_HOME. Its value should be the path to the top of the Java install. C:\program files\java or the equivalent.
Now edit the Path variable and add the following to the end - ;%JAVA_HOME%\bin
Save the changes. Start a command window (Start:Run:cmd:enter) or Programs:Accessories:DOS command window). Type java -version and press enter. If you get bad command or filename, you did not set the JAVA_HOME correctly.