• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running java applications on older versions of Java  RSS feed

 
jon Li
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm building a Windows Java app that is intended to run on computers with older versions of Java. (due to certain reasons, they are not plugged to the internet).
I made use of lambda expressions to replace nested inner classes in the code and it appears that its a new feature in Java 8. Could anyone advise if there would be any issues running the jar file in Java 7? if there is, must the computer install Java 8?


Thank you.




 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jon Li wrote:Could anyone advise if there would be any issues running the jar file in Java 7? if there is, must the computer install Java 8?

Yes, and maybe. I had a similar issue, and one way around it is to build a native installer that installs the Java 8 runtime along with your application jar. I used NetBeans (Native Packaging in NetBeans IDE). A plus is that this allows Java 8 applications to run in WindowsXP; the downside is that the installer is >40MB.

If you haven't used any API new in Java 8 (like java.time classes, Stream, the new functional interfaces...) it may be easier to change your code to comply to Java 7 / 6 specs.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am pretty sure there would be issues and the code would not run on Java7, but I suggest you try it.
 
jon Li
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
thanks for the advice because it is difficult to test it myself in person (other than asking my colleague to try it out for me).
I think i will have a go at the native installer as suggested by Darryl.

thanks once again!
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome, and do let us know how it went.
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jon Li wrote: . . . it is difficult to test it myself in person . . .
No, it would be very easy. It will just take ten minutes for installing.
Download Java7 here and install it. Then you can use JDK7 temporarily by writing something like
set PATH=c:\Program Files\java\jdk1.7.0_75\bin;%PATH%
at a Windows® command line
or
export PATH=~/java/jdk1.7.0_75/bin:$PATH
on a Linux/Unix terminal.

Obviously it will be different for you because you will install it in slightly different locations.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!