5

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.

1

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks you. It worked for me. For all the people who are using NetBeans, you can follow this link: stackoverflow.com/questions/1946394/…. It helped a lot.
Can be executed on Pi from terminal java -jar path/to/jar/Name.jar
0

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.

1 Comment

Yup. It has a new line and fortunately I found a link which helped me. Thanks for your input. Appreciate it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.