File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Help

 
William Hipschman
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, I went to Barnes and Noble yesterday with my uncle and I bought HeadFirst Java. I love this book! I'm am only 12 but I am fascinated by computer programming. I know mostly pascal, which is how I got a kick-start at Java.

So... I need help.
When I go to compile a .java file, it returns this:
Registry key 'Software\JavaSoft\Java Runtime Enviroment\CurrentVersion'
has value '1.5', but '1.4' is required.
Error: could not find java.dll
Error: could not find Java 2 Runtime Enviroment


Any ideas?

Thanks,
Wil
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wil,
Welcome to JavaRanch and welcome to Java! Head First Java is a great and entertaining book to learn from.

Are you using an IDE? If so, which one? (Eclipse, NetBeans, ...)

If you are compiling at the command line, try "javac *.java" to compile or javac -version to get your version number and post the results here.
 
William Hipschman
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Wil,
Welcome to JavaRanch and welcome to Java! Head First Java is a great and entertaining book to learn from.

Are you using an IDE? If so, which one? (Eclipse, NetBeans, ...)

If you are compiling at the command line, try "javac *.java" to compile or javac -version to get your version number and post the results here.


Thanks Jeanne.

I put in "javac *.java" (no quotes) in at the command line, and got the same response returned.

No IDE, would you recommend getting one? (if so, which one?)

Thanks,
Wil
 
Joel McNary
Bartender
Posts: 1824
Eclipse IDE Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't recommend an IDE yet. Once you get something like this figured out manually, you will be a long way toward understanding how IDEs work.

That said, I don't think that I've seen this particular problem before. What happens if you type
at the command prompt?
and
as well?
It looks like your compiler and the runtime are actually different versions.
 
Manuel Moons
Ranch Hand
Posts: 229
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you should download the Sun SDK 1.4 or 1.5 and (re)install it. It looks like something is wrong in your registry.
 
Ryan McGuire
Ranch Hand
Posts: 1048
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been a while, but I got a message similar to this when I had version of Java installed. My JAVA_HOME environment variable "pointed to" one version but the other was first in my PATH.

What values do you have for these? Since you already have a Command Prompt window up, do this:
> echo %JAVA_HOME%
> echo %PATH%
(The >'s are the prompts; don't type them.)

What do you get?

Also, do you know how to run the registry editor? At a command prompt type...
> regedit

Go to HKEY_LOCAL_MACHINE/Software/JavaSoft. Is there a "Java Runtime Environment" there? If so what's in it?

In your Control Panel, do you have Java icons? If you open it/them, do you see any version numbers?

And lastly, if you go to Control Panel/Add or Remove Programs, what Java or J2xx items do you have?

Between all these bits and pieces I'm sure we can hammer this out.

Ryan
 
William Hipschman
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here is my current version:


And here is what I get from SET PATH...and from echo %PATH% as well...


When I enter echo %JAVA_HOME% , it just returns %JAVA_HOME% (makes sense, sorta)


Entering in regedit results in this being returned...



HKEY_LOCAL_MACHINE\Software\Javasoft at the command line returns...




And I tried finding the directory, no luck.



Yes I have Java icons in the CP, it tells me the same exact version as typed before.



The Java items at add/remove programs are.....

J2SE Runtime Enviroment 5.0 Update 2
Java 2 Runtime Enviroment, SE v1.4.2
Java 2 Runtime Enviroment, SE v1.4.2_03
Java 2 Runtime Enviroment, SE v1.4.2_08
Java 2 SDK, SE v1.4.2_08


And thats it.....

Any more ideas?

Thanks,
Wil
 
Aly Gilani
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,

It seems that you have a couple of different runtime environments and a SDK. The SDK is 1.4 but the runtime environment is 1.5.

I think you should remove all the current installations of java (SDK and JRE) and download the SDK from java.sun.com (The SDK includes JRE)

Hope that helps.

Aly
 
William Hipschman
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Aly,

I removed every Java application I have and went ahead and downloaded the Java 2 SDK 1.4.2 With Net Beans. I figured it would be better just to download it all at once.

So now I'm waiting for this to finish downloading, then install it.

I'll keep you guys posted.

Thanks for all your help everyone,

Wil
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wil,
Whether you use NetBeans or not, there isn't any harm in having it on the machine. I wasn't advocating using an IDE. In fact, it's better (and often easier) to learn at the command line. It's just that the error you got is one that sometimes IDEs give and I wanted to help narrow down the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic