Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a JAR file and running on Raspberry PI

This is a very common question and there are chances that this might be marked as Duplicate, but even after reviewing a lot of answers and posts from stackoverflow and other communities, the problem just doesn't solve.

I have created a Project in my NetBeans IDE 7.3 and I Build the Project to get the JAR file by pressing SHIFT+F11. The next step, I perform is through WinSCP I copy the JAR file from my Windows Machine to the directory (/home/pi) in Raspberry PI. Now, I am in the directory in my Raspberry PI where the JAR file is present and in the terminal I run the command

java -jar ProjectFinal.jar

I get the error "Could not find or load main class".

The contents of my JAR are as shown below (in the form of directories): lib (contains all the libraries) META-INF (contains a MANIFEST.MF file and the contents looks fine) and the contents are shown below:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.4
Created-By: 1.7.0_17-b02 (Oracle Corporation)
Class-Path: lib/super-csv-2.1.0.jar
X-COMMENT: Main-Class will be added automatically by build
Main-Class: projectfinal.ProjectFinal**

and finally projectfinal (contains all the class files). I tried to change the contents of the MANIFEST.MF file by following this link. But this couldn't help me either. Please suggest me any ideas that could get me out of this. It could be really helpful. I can share the code if it is needed. I am using JRE version 7. Any questions/inputs/ideas is deeply appreciated.

Please help.

Thanks a lot in advance.

like image 973
Mohammed Irfan Avatar asked Oct 22 '22 04:10

Mohammed Irfan


1 Answers

I don't know about NetBeans but Eclipse IDE has an option to export into a "Runnable JAR File" instead of a normal JAR file.
I had the same issue and it solved my problem.

like image 163
Sw4Tish Avatar answered Oct 30 '22 14:10

Sw4Tish