This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi friends, when we use a higher version, but want that our application run also on lower version of JDK also, then we use c:\>javac -target 1.3 hello.java here file name is hello.java and currently we are useing JDK1.5 and we want byte code of hello.java that is compatable to jdk1.3. This command does not run on jdk1.5 but this run on jdk1.4.
I want to know that -target option command runs or not on jdk1.5.
please tell me
Edisandro Bessa
Ranch Hand
Joined: Jan 19, 2006
Posts: 584
posted
0
Hi johny,
Here is the command : javac -source 1.3 OldCode.java
You can face a compiler warning if you have in your code some variable named assert.
If you want to compile your code for version 1.4 the command is javac -source 1.4 OldCode.java
Using the 1.4 version you will get a compile error if your code has some variable called as assert
"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself
vishnu hiranamayee
Greenhorn
Joined: Feb 23, 2006
Posts: 17
posted
0
assertion is added in java's 1.4 version then why will we get a complier error in 1.4. please let me know.
Bharat Roy
Ranch Hand
Joined: Jul 01, 2004
Posts: 156
posted
0
There's a target option too but I guess thats for J2ME.
Bharat Roy
Ranch Hand
Joined: Jul 01, 2004
Posts: 156
posted
0
JDK 1.4 --- assert is NOT a keyword until you compile it against -source 1.4 option.
JDK 1.5 --- assert IS a keyword by default. If you want to use assert as a variable name (which you should not) compile it against -source 1.3 option. (It will show you warning though)
Bharat Roy
Ranch Hand
Joined: Jul 01, 2004
Posts: 156
posted
0
Originally posted by vishnu hiranamayee: assertion is added in java's 1.4 version then why will we get a complier error in 1.4. please let me know.
You will get compiler error ONLY if you are using assert as a variable name and also compiling the code against -source 1.4 option.