• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java 1.4 and java 1.5

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess this is definitively the place for these Qs

What i know:
jdk is for developing: compiling, etc
jre is for running outside of development environment

What i've got:
C:\>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

From control panel i learn the following:
  • J2SE Development Kit 5.0 (183.00MB -> so small...)
  • Java 2 Runtime Environment, SE v1.4.2_06
  • Java " SDK, SE v.1.4.2_06 (428.00MB --> much bigger than tiger!)

  • I conclude i'm missing jre for 5...

    My Qs:
    1) is it possible beeing able to work with both 1.4 and 5 in a way they dont inferfere with each other?
    2) if yes, how can i switch, from command line, for example?
    3) if i dont have jre 5 i cant run tiger apps, right?

    thanks in advance

    edited:
    i just remembered one more: is it possible to switch jre's?
    [ March 16, 2005: Message edited by: miguel lisboa ]
     
    Ranch Hand
    Posts: 375
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    One way would be to refer to both JDK by absolute paths everytime you compile, instead of "javac classname.java". You could go further and create an ANT script with some sort of system property allowing you switch between 1.4 and 1.5 (this is what I would do).

    However, you shouldn't need to use both JDK's.
     
    Ranch Hand
    Posts: 3061
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:
    What i know:
    jdk is for developing: compiling, etc
    jre is for running outside of development environment

    ...

    3) if i dont have jre 5 i cant run tiger apps, right?



    Your definitions of JDK and JRE are correct. However, it's important to remember that the JDK already comes with the JRE. This means that it is redundant to have both installed on your system. It also means that you CAN run Tiger apps without installing the JRE 5 explicitly because it already comes with JDK 5, which apparently you have already installed.

    Layne
     
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Code written in 1.4 should compile and run just fine in 5.0, but the opposite is not true.
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    @Kashif Riaz

    You could go further and create an ANT script


    i'd still have to learn how to write that

    @Layne Lund

    It also means that you CAN run Tiger apps without installing the JRE 5 explicitly because it already comes with JDK 5, which apparently you have already installed.


    but i dont; well, i'll uninstall/reinstall; think is better having a clean install instead of downloading just the jre (not sure)

    thanks to all who answered!
     
    Layne Lund
    Ranch Hand
    Posts: 3061
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:
    @Kashif Riaz

    but i dont; well, i'll uninstall/reinstall; think is better having a clean install instead of downloading just the jre (not sure)

    thanks to all who answered!



    Are you saying that you think that you don't have the JRE 1.5 installed? Why do you say this? Have you tried to run any applications with it? If so, what errors did you get? I assure you that you DO have the JRE 1.5 installed because it comes with the JDK. If you post the steps you use to try and run a Tiger app and the error messages you recieve, we'll be able to help you from there.

    Layne
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    jre5 was deleted from my pc some time ago


    i know nothing about java 5 so copy pasted this bit of code from elsewhere, which i guess is only compilded with java 5
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    from a diferent machine where i just updated to java 5:


    C:\>java -version
    java version "1.5.0_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
    Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

    C:\>javac TesteJava5.java

    C:\>java -cp . TesteJava5
    23

     
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    miguel,
    I think you are confusing what your machine is configured to use with what you have installed.

    If you try to run javac on the command line (windows) it will use the first javac.exe it encounters on your PATH. (same thing for java & java.exe).

    If you try to run programs started with batch scripts they may use java/javac found based on your JAVA_HOME.

    Your PATH and JAVA_HOME may be set manually, using scripts, or set for your machine using the System Properties window. Use of system properties window is described for setting classpath in How to set classpath - section titled "Instructions on Setting the CLASSPATH on different Operating Systems - For Windows XP/2000/NT "

    An example:
    I set mine in system properties for jdk 1.4.2 and then use a script to change it to play around with jdk 1.5.
    1. set java_home to the jdk directory
    JAVA_HOME=c:\bea813\jdk142_04
    2. add java_home\bin to the beginning of the path
    PATH=%JAVA_HOME%\bin;<all the other path info already in there>

    My setenv5.bat -- I also set my ant_home and classpath in it.
    set JAVA_HOME=C:\_tools\jdk1.5.0_01
    set ANT_HOME=C:\_tools\apache-ant-1.6.2
    set PATH=%JAVA_HOME%\bin;%ANT_HOME\bin%;%PATH%
    set classpath=%classpath%;.

    1. open cmd window and try running your example with jdk 1.4.2

    2. set environment for JDK 1.5 and try again (no compile error)


    The other thing to remember is that stuff isn't happening by magic. If you wonder if you've got a JRE or JDK installed, go look in those directories. You can use windows explorer.

    My JDK 1.5.0 bin dir:
    C:\_tools\jdk1.5.0_01\bin>ls -l java*
    -rwxrwxrwx 1 user group 49248 Dec 6 21:08 java.exe
    -rwxrwxrwx 1 user group 49269 Dec 6 21:08 javac.exe
    -rwxrwxrwx 1 user group 49275 Dec 6 21:08 javadoc.exe
    -rwxrwxrwx 1 user group 49269 Dec 6 21:08 javah.exe
    -rwxrwxrwx 1 user group 49265 Dec 6 21:08 javap.exe
    -rwxrwxrwx 1 user group 49250 Dec 6 21:08 javaw.exe
    -rwxrwxrwx 1 user group 127078 Dec 6 21:31 javaws.exe

    JDK 1.5.0's JRE bin directory:
    C:\_tools\jdk1.5.0_01\jre\bin>ls -l ja*
    -rw-rw-rw- 1 user group 139264 Dec 6 21:49 JavaWebStart.dll
    -rw-rw-rw- 1 user group 24698 Dec 6 21:49 jaas_nt.dll
    -rw-rw-rw- 1 user group 118890 Dec 6 21:49 java.dll
    -rwxrwxrwx 1 user group 49248 Dec 6 20:04 java.exe
    -rw-rw-rw- 1 user group 32881 Dec 6 21:49 java_crw_demo.dll
    -rwxrwxrwx 1 user group 45171 Dec 6 21:31 javacpl.exe
    -rwxrwxrwx 1 user group 49250 Dec 6 20:04 javaw.exe
    -rwxrwxrwx 1 user group 127078 Dec 6 21:31 javaws.exe
    -rw-rw-rw- 1 user group 24679 Dec 6 21:49 jawt.dll
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    @Carol
    thanks a lot for your post!

    the idea of having diferent bat files looks excelent!

    as soon i get home i'll try it in my machine
     
    Ranch Hand
    Posts: 704
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    As java 1.5 can compile and run any program written for previous versions of java. Why have more versions on your pc?
    You can use the -source and the -target flags of javac if you need to ensure compatibility with a previous version.
     
    Carol Enderlin
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Nigel Browne:
    As java 1.5 can compile and run any program written for previous versions of java. Why have more versions on your pc?
    You can use the -source and the -target flags of javac if you need to ensure compatibility with a previous version.



    If my production system is running with the jdk that BEA supplies with WebLogic Server I tend to build and run with that exact version on my development server.

    It's not trivial to control every java or javac command used by my system, to pass in the -source and -target flags. e.g. weblogic compiling ejbs and jsps.
     
    Nigel Browne
    Ranch Hand
    Posts: 704
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Carol Enderlin:

    It's not trivial to control every java or javac command used by my system, to pass in the -source and -target flags. e.g. weblogic compiling ejbs and jsps.



    This is the exact reason for writing build scripts using make or ant. Once the script is written, compiling, run tests and distributing code does become trivial.
     
    Bartender
    Posts: 1844
    Eclipse IDE Ruby Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    However, as Carol pointed out, you don't have control (or at least easy control) of the parameters used by tools that compile at runtime -- things like an application server compiling JSPs dynamically, iReport compiling a JasperReport template, etc. In these cases, you would have to have multiple versions of the JDK installed and correctly target the one that you want to use.
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    @Carol Enderlin
    i just checked it at home:

    thanks again
     
    Carol Enderlin
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    My JDK 1.5.0 bin dir:
    C:\_tools\jdk1.5.0_01\bin>ls -l java*
    -rwxrwxrwx 1 user group 49248 Dec 6 21:08 java.exe
    -rwxrwxrwx 1 user group 49269 Dec 6 21:08 javac.exe
    -rwxrwxrwx 1 user group 49275 Dec 6 21:08 javadoc.exe
    -rwxrwxrwx 1 user group 49269 Dec 6 21:08 javah.exe
    -rwxrwxrwx 1 user group 49265 Dec 6 21:08 javap.exe
    -rwxrwxrwx 1 user group 49250 Dec 6 21:08 javaw.exe
    -rwxrwxrwx 1 user group 127078 Dec 6 21:31 javaws.exe

    JDK 1.5.0's JRE bin directory:
    C:\_tools\jdk1.5.0_01\jre\bin>ls -l ja*


    from my command line i cant use:
    ls -l java*
    What's wrong? (i'm using xp)

    thanks in advance
     
    Ranch Hand
    Posts: 580
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Marilyn de Queiroz:
    Code written in 1.4 should compile and run just fine in 5.0, but the opposite is not true.



    This is not necessarily true. JDK5 introduced new keywords (enum for example) into the language. So, some 1.4 code can break when migrated to 1.5 (or 5.0 or Tiger or whatever the heck they're calling it these days).
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    after all there�s still a small catch:
    when i turn on my pc and make java -version i'm told ist all (jdk and jvm) 1.4.2;
    if now i write javac at command prompt i get an error msg stating its an unrecognized command, etc:
    C:\>javac
    'javac' n�o � reconhecido como um comando interno ou externo,
    programa operacional ou ficheiro batch.
    C:\>java -version
    java version "1.4.2_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

    i guess its because jre5 was deleted from control panel (because some add-ons stopped working), though i can access it if i run my switch script enabling tiger:
    C:\>java -version
    java version "1.5.0_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
    Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

    so, to get my 1.4.2 jvm (get a positive answer to javac) i've to use a script, thought in my system properties i've JAVA_HOME and PATH with 1.4.2 ...

    Is there any solution for this?

    thanks in advance
     
    Layne Lund
    Ranch Hand
    Posts: 3061
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:

    from my command line i cant use:
    ls -l java*
    What's wrong? (i'm using xp)

    thanks in advance



    Sure you CAN type that. The question is what happens when you do? Does it give you an error message? You didn't show what happens in your above post.

    Layne
     
    Layne Lund
    Ranch Hand
    Posts: 3061
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    To clarify on some of the questions raised earlier in this thread, the above directory listing shows that you DO have JRE 1.5 installed. The programs java.exe, javaw.exe, and javaws.exe are all part of the JRE.

    The problem seems to be about the configuration of your system, rather than what is (or is not) installed. I'm not exactly sure where to start to help you get things sorted out....

    Well, let's start with figuring out what you have installed and what the system variables are set to. So, are JDK 1.4 and 1.5 installed? Also, what directories are they installed in? What are your PATH and CLASSPATH variables set to? If you can give us this information (and not change it while your waiting for a response), we should be able to work things out from there.

    Layne
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    The question is what happens when you do? Does it give you an error message?


    'ls' n�o � reconhecido como um comando interno ou externo, programa operacional ou ficheiro batch., which means more or less:
    ls isnt recognized as intern or extern command, operacional program or bat file.
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    the above directory listing shows that you DO have JRE 1.5 installed.


    that is not my directoy, but Carol Enderlin's

    So, are JDK 1.4 and 1.5 installed? Also, what directories are they installed in?


    C:\j2sdk1.4.2_06
    C:\Programas\Java\jdk1.5.0_02

    What are your PATH and CLASSPATH variables set to?


    JAVA_HOME:
    C:\j2sdk1.4.2_06
    PATH:
    bla bla;%JAVA_HOME%\bin;more bla bla
    i've no classpath in environment vars

    If you can give us this information (and not change it while your waiting for a response), we should be able to work things out from there


    i didnt

    thanks a lot for helping!

    edited:
    i just got this:

    [ March 19, 2005: Message edited by: miguel lisboa ]
     
    Layne Lund
    Ranch Hand
    Posts: 3061
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:

    'ls' n�o � reconhecido como um comando interno ou externo, programa operacional ou ficheiro batch., which means more or less:
    ls isnt recognized as intern or extern command, operacional program or bat file.



    Your translation is actually very close to what you would see in the English version of Windows. This meains that it cannot find the command 'ls', which I don't find all that surprising. This is traditionally a Unix command. The Windows equivalent is 'dir', so you should try that.

    Layne
     
    Layne Lund
    Ranch Hand
    Posts: 3061
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sorry, I missed the "quote:" above the directory listing. I apologize for that.

    Anyway, to help with your problem, it looks like you have both JDK 1.4 and 1.5 installed. Your PATH environment variable is set to run the tools from JDK 1.4. It's okay that you don't have a CLASSPATH variable. For now, you don't need it. I'm sure you'll learn more about its uses later.

    So now you need to decide what you want to do? Do you need both JDKs installed? If not, I would suggest that you uninstall JDK 1.4 and change your PATH to use JDK 1.5. With a small amount of work, you can use JDK 1.5 to compile .class files that can run on JRE 1.4.

    As a side note, you can see that he bin directory in both installations contain java.exe which is probably the main component in any version of the JRE. I'm just pointing this out to clarify that you DON'T need to install the JRE separately; it already comes with the JDK installation.

    Anyway, let us know what you want to do now and we'll try to help you figure it out.

    Layne
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    thanks for your answer(s)

    So now you need to decide what you want to do? Do you need both JDKs installed?


    yes because i allways worked with older but i want to have my environment prepared for tiger too

    Anyway, let us know what you want to do now and we'll try to help you figure it out.


    besides having both 1.4 and 5 i want that, when i turn my computer on and type javac in command line, i dont ever get this msg stating:

    javac isnt recognized as internal or external command, operacional program or bat file


    thank you
     
    K Riaz
    Ranch Hand
    Posts: 375
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Why not create batch scripts (say "java14compile.bat" and "java15compile.bat"), and pass your class to be compiled as an argument to it, which in turn would call the correct full path of the appropiate jdk executable (java or javac)? So if you wish to compile something in 1.4, you could fire up a cmd prompt, change to the directory of the scripts and "java14compile myClass.java" which would be translated to "C:\jdk1.4\....\javac.exe myClass.java".

    Excuse me if this is not relevant.
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Why not create batch scripts


    that's exactly what i'v been doing; see this one, for example:

    Excuse me if this is not relevant


    yw

    my prob is the one i refered previously: not having javac without running one of the scripts
     
    Carol Enderlin
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    miguel,

    sorry for the confusion with "ls -l" command. I've got unix utils installed on my machine. on xp without unix utils installed, I would use dir instead.
    [ March 20, 2005: Message edited by: Carol Enderlin ]
     
    Carol Enderlin
    drifter
    Posts: 1364
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:
    after all there�s still a small catch:
    when i turn on my pc and make java -version i'm told ist all (jdk and jvm) 1.4.2;
    if now i write javac at command prompt i get an error msg stating its an unrecognized command, etc:
    C:\>javac
    'javac' n�o � reconhecido como um comando interno ou externo,
    programa operacional ou ficheiro batch.
    C:\>java -version
    java version "1.4.2_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

    ...
    Is there any solution for this?

    thanks in advance



    It sounds like you need to modify your system's PATH. You say that running java -version indicates it's using 1.4.2_06. But, when you try to use javac it says it doesn't recognize the command. Sounds like your path is pointing only to a jre. JRE's don't have the tools such as javac for compiling. See my earlier post on how to look at change your path in your computer's properties, advanced tab, "Environment variables".
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    both path and java_home are perfect

    edited:

    case solved!

    An example:
    I set mine in system properties for jdk 1.4.2 and


    what was left was adding PATH and JAVA_HOME to user properties, because in system properties they were allready (well) defined
    btw, thanks for helping
    [ March 20, 2005: Message edited by: miguel lisboa ]
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    i just downloaded thinking in java and then tried to run ant build






    Why? (with an earlier ant version,and from another machine, i run ant smoothly)
     
    Ranch Hand
    Posts: 5093
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    because once again you're using a 1.4 runtime to try and load a 1.5 classfile.
    I thought you'd have learned to recognise the signs by now, they've been explained to you several times already.
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    because once again you're using a 1.4 runtime to try and load a 1.5 classfile.
    I thought you'd have learned to recognise the signs by now, they've been explained to you several times already.




    i'm quite aware that my knowledge concerning java and related subjects and tools is shaky; this said, you'v to admit i did thought of that and also that you'v rushed into a wrong conclusion.

    i've no idea how ant works internally, but from what i understand what ant does is read from a .java file and output the correspondent .class file.

    so at first try, with java5, i got a msg saying a nonsense: JDK 1.4.1or higher is required to run the examples in this book
    now i know why:


    when i switched to 1.4.2 i got another msg, this one about versions;
    from what you explained elsewhere, that should happen if i had compiled in 5 an were trying to run it in 1.4

    but, since ant build failed, i could not possibly have any class files

    also, would ant try to run those hipothetical classes and in consequence print that version msg?

    in conclusion: i dont think i�m the dumb you'r saying
     
    Nigel Browne
    Ranch Hand
    Posts: 704
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ant will run the targets it is asked to. In the project target you will have a line similar to this:
    the default argument runGui tells Ant to run that target. Now if we look at that target
    we see that it its dependent on the target build. So let's look at build
    Aha here we see that the code is being compiled using javac and the code is 1.5 compliant.
    I know this is a basic look at Ant target but I recommend that you do learn to use it properly. The manual can be found here
     
    Jeroen Wenting
    Ranch Hand
    Posts: 5093
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by miguel lisboa:

    but, since ant build failed, i could not possibly have any class files

    also, would ant try to run those hipothetical classes and in consequence print that version msg?

    in conclusion: i dont think i�m the dumb you'r saying



    You could have known perfectly well you had the wron JVM and classversion from the output...

    C:\aaa-TIJ3-distribution>java -versionjava version "1.4.2_06"Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode) C:\aaa-TIJ3-distribution>ant -versionApache Ant version 1.6.2 compiled on July 16 2004C:\aaa-TIJ3-distribution>antBuildfile: build.xml run: JDK.version.check:[CheckVersion] java.lang.UnsupportedClassVersionError: com/bruceeckel/tools/CheckVersion (Unsupported major.minor version 49.0)



    When you're compiling dependencies between classes are resolved by loading already compiled classes. As you're still using a 1.4 runtime with a 1.5 compiler...
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    @Nigel Browne
    Thanks a lot for your post: you put me in the right track!

    when i first tried to ant/build with java 5 i got that msg saying (among other things) BUILD FAILED.

    what i was thinking at that time was that no file at all would compiled, but that's where i went astray: ant did compile one single file: the dreaded CheckVersion.java

    (i was checking only inside respective chapter folders and deducing that, since build had failed, no class files where generated)

    so at this point Jeroen is right: i was using a 1.4 runtime to try and load a 1.5 classfile.

    and this because ant checks it all (though i wasnt aware at all)

    when trying to reproduce last night's problem i found out that if i delete that file, then i can use ant again

    i went to check TIJ buil.xml: has 467 lines! and most of it is totally incomprehensible to me.

    i which i had more spare time to get informed about so many badly needed subjects

    this is overwhelming!
     
    miguel lisboa
    Ranch Hand
    Posts: 1282
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    You could have known perfectly well you had the wron JVM and classversion from the output...


    if i hadnt become influenced by that first msg in the sense that something without any sense (and behond my control) was going on, i'd have paid enough atention to that second msg

    in other words: how can one trust output msgs if what they state is a nonsense?

    As you're still using a 1.4 runtime with a 1.5 compiler...


    if you mean: (...) with a class compiled with 1.5 i agree, else that's not what i was doing
    [ March 23, 2005: Message edited by: miguel lisboa ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic