Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

different jdk versions for build and run

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many frameworks, I have seen document the fact that their source code should be build on say jdk1.4.2 , but once compiled and jared, it runs on jdk1.3.x
I am not able to understand the logic .. can anyone help?
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give a specific example of this? Generally, compiling on version 1.x and running on 1.(x-1) will lead, eventually, to NoSuchMethodErrors and other problems.
 
Monmohan Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think i messed up..
here is what happens

The code is build on 1.3.09 ..
but run on 1.4.02

If performance of reflection is the reason, why should the code not be build on 1.4.02.. what can be other reasons?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can think of at least three cases (importing classes from the default package, using the new keyword "assert", or calling a newly deprecated method) where JDK 1.4's compiler would reject or warn about code that would compile without comment under JDK 1.3.
 
Monmohan Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in case of deprecation, the compiler would warn.. so that is fine
.. the assert keyword was introduced in 1.4?
and in case of methods which are removed , if the code compiles on 1.3 and run on 1.4, shouldn't it give an error?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun has never removed a deprecated method.

Sometimes people will tell you to compile on 1.(x-1) because 1.x will give warnings, because they don't want you to see the warnings and think the code is bad. That's just silly, but it's what some people do.

If you compile code that uses "assert" with the 1.4 compiler, you just get a warning, so again, it's not an error.

But the "import from the default package" thing is a hard error in 1.4. If you have a class Foo in the default package (i.e., not in a package) and another class in a named package, then that second class's source could include

import Foo;

in 1.3, but with the 1.4 compiler, this won't compile.

This is easy enough to fix for the developers, but some people resist it, for some reason.
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic