Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jdk 1.5 OutOfMemoryError

Status
Not open for further replies.

ksbrace

Programmer
May 13, 2000
501
US
Hello,
I just downloaded and installed jdk 1.5.0. Changed the Path variable from 1.4 to 1.5. I typed java -version to confirm my change took place. I then proceeded to do a quick Hello World example to make sure everything was working. When I go to compile: javac HelloWorld.java, It takes about 1.5 minutes and then I get the following error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space. Here's the code:
Code:
public class HelloWorld{

  public static void main(String[] args) {
  
      System.out.println("hello world");

  }

}
Any ideas as to why I get this error?

 
What is the rest of your machine doing ?
Does it compile OK using 1.4 ?
What OS are you using ?
How much RAM have you got ?



--------------------------------------------------
Free Database Connection Pooling Software
 
works fine under 1.4. I have win xp pro W/OUT SP 2. I have 2 gigs of ram. The rest of the machine is sitting idle 3GhZ processor. I do a lot of Oracle intensive stuff, but after the first time I got the error, I shut everything down and only had a browser window opened and the system console window.

 
That is bizaar. I've seen windows often almost "hang" during compilation sometimes, but never thrown an error.

I searched the Sun bugbase for you, and can see no bugs logged for this behaviour ... not sure what to suggest really ...



--------------------------------------------------
Free Database Connection Pooling Software
 
Sedj,
Yeah, I have been on bugbase and the developer's forum looking for something similar, as well. Thanks anyway!


 
Do you compile from commandline, or jdeveloper or something?

On my linux 2.6.8.1, 1.1 Ghz, 256MB Ram it takes 1.5 sec. compiles and runs without problems. (I made the experience that I may oversee simplest problems, so I prefer to test, instead of thinking.
Golden Rule: Don't think, if you can avoid is!)

But it didn't work this time, so I start thinking:
You're sure, you saved the file as HelloWorld.java?

seeking a job as java-programmer in Berlin:
 
You didn't mention deleting 1.4 before the 1.5 install. Perhaps they have trouble co-existing.

If I were in your position, I would remove both jdks and then reinstall 1.5 fresh (retaining 1.4 somewhere, of course, in case you have to go back to it).
 
you might want to change

public static void main(String[] args)

to

public static void main(String args[])
 
I don't have any problem with running JDK 1.5 on Win XP (SP2). My 1.5 co-exists pretty well with the 1.4.2 (I didn't delete it). They both works well with Ant and JUnit for my projects so far.

I am thinking that probably your 1.5 didn't install properly or perhaps the downloaded files was corrupted along the way. Try uninstalling 1.5, re-download the files, and install it again.
 
Thanks for all of the replies. Sorry for the late response, I was camping one last time before the weather turns cold. It turns out that the download must have been corrupted somehow. I uninstalled 1.5, redownloaded and reinstalled and everything is working fine. I have 1.4 and 1.5,co-existing and working. Thanks again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top