Java – create a jar file and run it on the raspberry PI

This is a very common problem and it is possible to mark it as a duplicate, but it cannot be solved even after reviewing a large number of answers and posts from stack overflow and other communities

I created a project in NetBeans ide 7.3 and obtained the jar file by building the project by pressing shift F11 Next, I copy the jar file from my windows machine to the directory in raspberry PI (/ home / PI) through winscp Now, I'm in my raspberry PI directory, where there are jar files, and I run commands on the terminal

java -jar ProjectFinal.jar

I received the error "unable to find or load the main class"

The contents of my jar are as follows (in the form of directory): lib (including all libraries) meta-inf (including a manifest.mf file, which looks good), and the contents are as follows:

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**

Finally, project final (including all class files) I'm trying to change manifest by following this link Contents of MF file But it doesn't help me either Please advise me of any ideas that can get me out of this idea It may really help I can share the code if necessary I am using JRE version 7 Any questions / comments / ideas are highly appreciated

Please help.

Thank you very much in advance

Solution

I don't know NetBeans, but the eclipse ide can choose to export to "runnable jar file" instead of ordinary jar file I have the same problem. It solves my problem

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>