Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems compiling for java 1.5/5.0

 
Werner van Mook
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I do have a very basic java question.

I have the following class :

public class IntTest
{

public static void main(String[] args)
{
Integer i = 100;
Integer i2 = 100;
System.out.println((i == i2)? "Yes equal": "Nope not equal");

}
}

I want to compile this class on a win2000 system with jdk 1.5 installed.
java -version gives me :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

If I'm correct : I want to compile this. because I use autoboxing I have to compile this using the -source 1.5 flag.

If I do : javac -source 1.5 IntTest.java
I get :
javac: invalid flag: -source
Usage: javac <options> <source files>
where possible options include:......... etc.
In the list with possible options it does not state : source

What am I doing wrong?

Kind regards
Werner
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Werner van Mook:
java -version gives me :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
What does the following give you?
 
Werner van Mook
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It tells me that you can't do javac - version.

javac: invalid flag: -version
Usage: javac <options> <source files>
where possible options include:.......
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Funny, I get this:I would have expected the -version flag to have existed in 1.0, but maybe it's not and you have an ancient JDK on your system. Does your path include multiple JDKs?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic