aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes use a specific jvm with ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "use a specific jvm with ant" Watch "use a specific jvm with ant" New topic
Author

use a specific jvm with ant

Brock Awadmay
Greenhorn

Joined: Oct 16, 2009
Posts: 5
I am currently in a situation where I must use a supplied modified jvm /jre version 1.4. If you must know its the JVM/jre that is supplied with IBM's WebSphere Application Server 6.1.

In order for the class files to work when deploying to WAS. I need to build using the same jvm as WAS. I have tried using the standard jvm to complie. (this hasn't worked for me yet, so I currently import the IBM modified JRE into eclipse and use the ant build functionality from within Eclipse (IBMjre) ).

I have several projects with classes in each that are used in the final project. Currently I am required to use the IBMjre in each project and build each project individually and pull the complied class files into the ear that I deploy.

1) I want to be able to build in one location, not 3 separate.
2) I do not want to have to import the IBMjre int eclipse to develop, to be able to develop and clean in eclipse using new version of jre (1.6), and when comes time to build the project ear do so with the IBMjre at that time. Backwards compilation of files developed on new version (in my understanding) is not an issue.

Currently each project has the following build.xml file.


then in the final project I pull in all the compiled .class files from each project and build the ear.


To solve 1) I envisioned doing three separate <javac> calls in the final build.xml file. Each to each of the projects.
This isn't hard, but I wonder if there is a better way to do this.

To solve 2) assuming I implement solution to 1 above, I wanted to override the jre that ant defaults to using.
by defining . but this causes an error in ant javac



I have read the ant manual I use ant version 1.6.5. Must I create a class that implements CompilerAdapter and point it to the IBMjre? If so is there any guidance on doing so?
would I be better off to upgrade my version of ant?

Please gurus of ANT give me guidance.


Really the source of many problems is WAS, and what I must do to get this project working with ILOG JRules. If you have any pointers, suggestions, knowledge to share or where I can gather more information It will be greatly appreciated.

THANK YOU for your time and effort.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

I don't know where you're getting this "customized JRE 1.4" thing. WAS 6.1 comes with JDK 1.5 and the actual JVM is fully Sun-certified, not some custom thingy. The only "custom" is the support JARs, and that's no more custom than any other J2EE platform implementation would be.

I had a nice little talk with IBM recently, and they support both 2 separate JVM options on WAS, although they said that the J9 JVM was the way to go for performance and portability.

You do not have to compile Java using the same JVM that it will run under. That's part of the point of Java compiling to bytecode. Write once, run anywhere. However, you do have to have compatible Java version levels.

Fortunately, since Sun isn't Microsoft, there's backwards compatibility. Using the proper Ant settings you can select what java source level you're expecting and what JVM version the compiled bytecodes will be for.

If you're using J9, there are versions for the different IBM platforms, and I was assured that the Intel and iSeries J9 compilers and runtimes were totally inter-compatible, so it's not a bad idea to pull a copy onto your build systems and configure Ant to use it. But it's not 100% essential.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: use a specific jvm with ant