aspose file tools*
The moose likes Beginning Java and the fly likes installing multiple versions of java 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 » Java » Beginning Java
Bookmark "installing multiple versions of java" Watch "installing multiple versions of java" New topic
Author

installing multiple versions of java

srini manassu
Greenhorn

Joined: Jan 07, 2012
Posts: 11

Hello Ranchers,

I want to know how to install java i.e. in order to run java programs what are all the necesssary packages required...
in the same context I would want to install java on windows(XP) as well as on linux (ubuntu) systems,
and also can I be able to install different versions of java 5, 6, 7 on the same OS?

PS: kindly provide a link to get the java package (required to install) (5, 6, 7) versions.

Thank you.
Deepak Rao
Ranch Hand

Joined: Jan 24, 2012
Posts: 31

Hi Srini

It is very much possible to install multiple versions of java in one OS. You will have to point to the right Java version when you run java programs.i.e The version you need.
If you are looking at Sun jdk the link for installables is http://www.oracle.com/technetwork/java/archive-139210.html

Thanks
Deepak
Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

you can use latest version and you can compile java file from different version from latest version.

eg.

javac -target 1.4 *.java
javac -target 1.5 *.java
javac -target 1.6 *.java

The -target 1.4 option ensures that the generated class files will be compatible with 1.4 VMs.


SCJP 6- 91%, IBM DB2, IBM RAD Certified
Shahzad Latif
Greenhorn

Joined: Apr 28, 2011
Posts: 28
You can definitely install and use multiple versions of JDK on a single machine/OS. Just install the JDKs into different folders and then change the version when compiling your programs. If you want to test your code using different Java versions, you can create .bat files with various versions and then just execute one of those .bat files before using a particular version. For example, a .bat file for JDK 1.6 might look something like this:



You can name the file as jdk6.bat and then only execute this file before testing your program. You can do the same for other JDK versions.


Developer Evangelist @ Aspose. I love to explore and learn new technologies and help other developers along the way.
srini manassu
Greenhorn

Joined: Jan 07, 2012
Posts: 11

@Deepak:
Thanks for the links, I really wanted one.

@Sachin:
Yeah this is the cool (simple) option, Thanks for letting me know.

@Shahzad:
I think you are a windows guy the .bat is good, thanks, I don't regularly use windows, but this helped me do some ``work'' with windows
Shahzad Latif
Greenhorn

Joined: Apr 28, 2011
Posts: 28
@Sirini,

I assumed you were using Java on Windows. My bad!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: installing multiple versions of java