File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple JDK's and JRE's

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have need to run at least two different JDK versions, 1.3.1 and 1.4.
What is the best way to compile code using the two individually without having to be in the JDK's Bin directory, or using an absolute path to that JDK's Bin Directory every time.
I was thinking of using a batch file, but I don't know how I would get the batch file to take in arguments. i.e java1.bat myProgram where java1.bat runs the JAVAC for 1.3.1 and myProgram is the program to be compiled.
Thanks
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have several bat files out there.
For instance I have j131.bat, j140.bat etc. When I want to use a particular release, I run the bat that sets up a different path and classpath on the fly.
I just work in the working directory that I set up for each of these.
Then you can just work as normal.
However, If you want to invoke a particular JRE when starting your program (perhaps a different one from what your normal classpath points to) you can just specify when you invoke the application. The actual call to the app is bolded.
example RunAPP.bat:

cd \"Program Files"\app
path = .;C:\"Program Files"\app;C:\"Program Files"\app\jre\bin;
"c:\Program Files\app\jre\bin\javaw" -classpath .;"c:\Program Files\app";"c:\Program Files\app\app.jar";"c:\Program Files\app\deploy.jar";"c:\Program Files\app\jre\lib\rt.jar";"c:\Program Files\app\jre\lib\jaws.jar";"c:\Program Files\app\jre\lib\i18n.jar";"c:\Program Files\app\classes12.jar";"c:\Program Files\app\images" app.client.APPDesktop "c:\Program Files\app\APP.properties"
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So instead of running a batch file that runs the compiler, you just set up a batch file that resets your paths to whatever you need them set to. Smart Lady
Thanks Cindy. As always you have solved my problem.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic