Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

installing multiple versions of java

 
srini manassu
Greenhorn
Posts: 11
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 248
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shahzad Latif
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
srini manassu
Greenhorn
Posts: 11
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Sirini,

I assumed you were using Java on Windows. My bad!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic