4thdwarflord
Posts: 142
Joined: Mon Dec 03, 2012 4:26 pm
Location: Deep in the mines of Moria

Can the Pi run .jar files?

Sun Dec 30, 2012 6:57 pm

A bit of a noobish question, but can the Pi actually run .jar files, and what do I need so I can? The explanation on the downloads page is a bit misleading when it says about the JVM. I'm still not sure exactly what that is.

agent_paul
Posts: 1
Joined: Sun Dec 30, 2012 6:59 pm

Re: Can the Pi run .jar files?

Sun Dec 30, 2012 7:02 pm

It sure can. As long as you have you java environment setup correctly, all you have to do is type (off the top of my head): java -jar pathAndFilename.jar

User avatar
savageautomate
Posts: 225
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
Contact: Website

Re: Can the Pi run .jar files?

Sun Dec 30, 2012 8:25 pm

4thdwarflord wrote:The explanation on the downloads page is a bit misleading when it says about the JVM. I'm still not sure exactly what that is.
... just to clarify what the downloads page is talking about ...

You can use the OpenJDK on any of the Linux distributions available. It's easy to install and already available in the apt-get repository for Raspian. Just use this command on the Pi's console or terminal to install the OpenJDK.
sudo apt-get install openjdk-7-jdk
However, if you want to use Oracle's version of the JDK or JRE, then the current released JDK7 for the Pi (JDK7SE with ARM support) it only supports soft-float (ABI) based distributions of Linux. Thus you can only use this on the older Debian "Wheezy" Linux distribution available on the downloads page. Most users are installing the newer and more actively updated Raspbian Linux distribution available on the downloads page, but this is a hard-float (ABI) based Linux distribution and thus not compatible with Oracle's JDK7 for ARM.

Here are installation instructions on how to install the Oracle JDK7 on a Raspberry Pi using a Debian "Wheezy" (soft-float) distribution:
http://www.savagehomeautomation.com/raspi-jdk7


OK .. one more curve ball .... very recently Oracle announced (http://www.raspberrypi.org/phpBB3/viewt ... 81&t=26110) an early access development release of the JDK8 for ARM which does support hard-float (ABI) based systems. This JDK8 should be considered experimental since it is not released.

Here are installation instructions on how to install the Oracle JDK8 early access on a Raspberry Pi using a Raspian "Wheezy" distribution:
http://www.savagehomeautomation.com/raspi-jdk8


One last thing to consider ... "Why would I want to run the Oracle JDK versus the OpenJDK" ?
Well, the Oracle JDK includes a JIT compiler that allows your Java program to run much faster compared to the OpenJDK (Zero VM) with no JIT. There are options in the OpenJDK to run using alternate VMs (such as Jamvm, Avian, Cacao) that do support varying levels of JIT compilers and performance enhancements, but I have not yet seen any stats that outperform Oracle's VM.

Here is an article that I published a while back comparing the Oracle JVM and the OpenJDK using Zero VM: http://www.savagehomeautomation.com/pro ... marks.html

Also see this thread for more recent performance testing results with some of the other OpenJDK VMs: http://www.raspberrypi.org/phpBB3/viewt ... 81&t=25418

Regards, Robert
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com

User avatar
savageautomate
Posts: 225
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
Contact: Website

Re: Can the Pi run .jar files?

Sun Dec 30, 2012 8:28 pm

Oh, one other thing to note that is you can install multiple JVMs on your system such as OpenJDK 7 and Oracle JDK SE 8 early access and then switch between them as needed/desired.

Check out this how-to article for switching between JVMs on Debian/Raspbian:
http://www.savagehomeautomation.com/pro ... e-jvm.html
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com

4thdwarflord
Posts: 142
Joined: Mon Dec 03, 2012 4:26 pm
Location: Deep in the mines of Moria

Re: Can the Pi run .jar files?

Mon Dec 31, 2012 4:07 pm

thanks for the instructions onn running jar files, and thanks for the thing about openJDK vs oracle JDK. i had no idea since the answer was nowhere to be found.

User avatar
savageautomate
Posts: 225
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
Contact: Website

Re: Can the Pi run .jar files?

Tue Jan 01, 2013 11:54 pm

You are welcome and glad to have you with us :D
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com

milkybar_ton
Posts: 26
Joined: Fri Nov 30, 2012 8:25 pm

Re: Can the Pi run .jar files?

Tue Jan 22, 2013 12:12 pm

Hi there,
For the numptys out there like me can you be a bit more specific with regards to opening the file please?
I've downloaded project libre, i can click on it in the downloads file and i get a list of the files once they are unarchived but can't find the route to the file (new to Linux, previous experience limited to mac). I can't drag and drop it onto the desktop.
thanks in advance

mihol
Posts: 23
Joined: Wed May 09, 2012 6:55 pm
Location: Germany

Re: Can the Pi run .jar files?

Tue Jan 22, 2013 12:44 pm

Hi milkybar_ton,

I'd guess this type of basic 'How to' questions are best handled outside of this specific JAVA forum. Entire websites have been created for learning and teaching LINUX. i.e. http://www.tldp.org/HOWTO/HOWTO-INDEX/howtos.html
The recommended links are:
http://community.linuxmint.com/tutorial/view/100
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html
Hope this helps
Regards
Mike

User avatar
savageautomate
Posts: 225
Joined: Thu Aug 16, 2012 3:20 pm
Location: USA
Contact: Website

Re: Can the Pi run .jar files?

Thu Jan 24, 2013 11:29 am

This page describes how to install Pi4J and where the files are installed and includes instructions for how to compile the examples.
http://pi4j.com/install.html

Beyond that, you may want to explore some of the examples starting with this page:
http://pi4j.com/example/control.html


Thanks, Robert
Robert Savage | Follow me @savageautomate
http://www.pi4j.com | http://www.pislices.com
http://www.savagehomeautomation.com

FeminD
Posts: 26
Joined: Sat Dec 06, 2014 1:17 pm

Re: Can the Pi run .jar files?

Fri Dec 19, 2014 6:23 am

agent_paul wrote:It sure can. As long as you have you java environment setup correctly, all you have to do is type (off the top of my head): java -jar pathAndFilename.jar
There is a minecraft version on minecraft.net (not the pi version) it says its for linux and is .jar file ? will it run on raspi

User avatar
DougieLawson
Posts: 35594
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Can the Pi run .jar files?

Fri Dec 19, 2014 8:24 am

FeminD wrote:There is a minecraft version on minecraft.net (not the pi version) it says its for linux and is .jar file ? will it run on raspi
No!
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Java”