This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Cannot compile in 1.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot compile in 1.5" Watch "Cannot compile in 1.5" New topic
Author

Cannot compile in 1.5

Nischal Topno
Ranch Hand

Joined: Nov 24, 2001
Posts: 45
I just started with java 1.5 and I am not able to compile the following code:

It throws the following error:

I have not installed the jdk 5 but copied the "j2sdk1.5.0" folder from another machine. I earlier thought it to be a path problem so i copied my source file in to j2sdk1.5.0\bin folder and tried compiling it, which gave me the same error.

Can any body help me the silliest mistake i am making.

Nischal
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


I have not installed the jdk 5

Hmm. This might be the source of your problem. Run "java -version" to see which version you are really using.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Nischal Topno
Ranch Hand

Joined: Nov 24, 2001
Posts: 45
I did thought that this might be an issue & so have changed the path and other variables to point to the folder where this jdk is copied. Following is the output:
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Okay, "java" is 1.5, but what about "javac"? Run:


There is no emoticon for what I am feeling!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Jeff Albrechtsen:
Okay, "java" is 1.5, but what about "javac"? Run:


Or just "javac -version" -- new switch in Java 5!


[Jess in Action][AskingGoodQuestions]
Nischal Topno
Ranch Hand

Joined: Nov 24, 2001
Posts: 45
Hi,

I am trying to compile the file in the bin folder itself, but still it does not compile.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14280
    
  21

Install JDK 5 properly, that will solve your problem.
Just copying the jdk1.5.0 folder from another machine does not work.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
Use Java5 with Eclipse as your editor. Eclipse gives you compliance options (1.3, 1.4, 5), so you can be aware of what version of Java you are coding to.


ASCII silly question, Get a silly ANSI.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

Also, your version shows that it is a beta version of Java 1.5. So that is over a year old. Java 1.5 is in production for over a year.

I suggest downloading the SDK from sun and installing it.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

Don't you have to import LinkedList?

Mark
Nischal Topno
Ranch Hand

Joined: Nov 24, 2001
Posts: 45
Hi Mark,

I did realize the mistake. I corrected the source file, but still i don't get through with compiling. As suggested by others, let me download the latest version of jdk5, install it, and check out.

Nischal
 
jQuery in Action, 2nd edition
 
subject: Cannot compile in 1.5