简体   繁体   中英

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.

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.

If not then follow this:

The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM