Could not find or load main class com.nabinbhandari.lam.Main - java

I've read a lot of troubleshooting for similar occurrences of this error, but what is causing it for this particular .jar?
https://download.cnet.com/android/nabin-bhandari/3260-20_4-10982661-1.html
It works on Windows, but when attempting to run the file on a raspbian (linux) system running java version 1.8.0_65 with the command java -jar Local\ Area\ Messenger\ Desktop.jar it throws the error about not being able to find or load the main class.
The MANIFEST.MF defines Main-Class: com.nabinbhandari.lam.Main and there doesn't appear to be any issues with case sensitivity.
What am I missing? Do I need to install something more than Java Runtime Environment?
Edit: In case it is not clear, I am not the developer of this file. I am simply a user trying to run the file. This question has nothing to do with Eclipse and I don't understand why people are linking to that other question. I am not running Eclipse. Please stop linking to that. Please examination the .jar file I have provided.
Edit 2: I have followed the instructions and in this answer:
https://stackoverflow.com/a/1238173/2407742
It gives the error no main manifest attribute, in test.jar
Is there something missing from my java runtime environment? It seems like nothing works.

The Local Area Network Messenger application was developed using JavaFX, which is not included in the Oracle Java build for Rasperry Pi. I had to reinstall Java and then openjfx by doing the following:
sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre
sudo apt-get install openjfx
It runs fine now.

The solution to this was the following:
Close Eclipse/STS
Use a file explorer on your operating system to navigate to your workspace (In my case, I'm on Windows so I used Windows Explorer)
Delete the .metadata directory (or to be safe, copy the directory somewhere else to be safe, then delete it)
Restart Eclipse/STS
Is there a more improved answer than this? I don't want to look like I'm trying to boost my own reputation points, so if someone can provide a better answer then please do so.

Related

How to import FFMPEG Library in my maven project?

I have a Spring-boot project, where I am using the ffmpeg library, I am executing the ffmpeg commands through a ProcessBuilder(in the terminal/cmd) and everything works fine, because I have already installed the ffmpeg on my macOS. When I try to generate a jar and run it on an another machine, where ffmpeg is not installed, it is executed, everything works fine, except the ffmpeg comamnds. Is there any change to import the library to my maven project or somehow to use it?
Is it a good idea to add an external jar of the library?
Thank you in advance!
Is the server you're deploying to Mac (same as your desktop) or Windows/Linux? The reason I ask is because ffmpeg is a binary app and has to be compiled to the specific platform.
You could include ffmpeg in maven, but before it runs it will need to be compiled. I found one maven repository here, though I do not know how well this will work: https://mvnrepository.com/artifact/com.tagtraum/ffmpeg/4.0.0. You could also try compiling from source (particularly if there's some non-standard encoding/decoding you're trying to do), which is a much more involved installation.
What I would do is install ffmpeg through a separate installation package, ideally through the OS's package management system; for linux this would be something like:
(Ubuntu)
sudo apt-get install ffmpeg
(CentOS)
sudo yum install epel-release
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel
More info on installation here:
https://www.ostechnix.com/install-ffmpeg-linux/
Sometimes these packages may be not be the latest or missing something you're trying to do, in which case you may need to compile from source.
Edit: You say you're using Windows. I'm not as familiar with deploying to Windows, but there are ffmpeg Windows packages available on this site (linked from the main ffmpeg page): https://ffmpeg.zeranoe.com/builds/ . I recommend installing separately rather than trying to package with your Java app. This page can help: https://windowsloop.com/install-ffmpeg-windows-10/
I’m not sure if Maven have a plug in for that, but I’d add a shell script to install ffmpeg, let’s call it resources/scripts/myscript.sh, in the script first validate it’s not installed already, then use wget to download what you need , install it , and continue with you app.
You can call this script from your app as the first thing to do

java how to check version being used by 'jar launcher.app' on Mac OS

I have several .jar files that run successfully when opened with Mac's built in 'Jar Launcher' (Version 15.0.1) but when ran from terminal they error out.
Looking online the error messages might be down to the incorrect version of Java being linked to the terminal version, so I'd like to check if the options set for 'Jar Launcher' and the Java used within terminal are the same.
Does there exist any way to do this?
This question is two years old, but as there is no answer to it, I thought I'd put my two cents here since I've had issues myself, and have made some observations.
It seems that the Jar Launcher doesn't necessarily use the same JVM version as the one shown by the command /usr/libexec/java_home: If there is a JRE /Library/Internet Plug-Ins/JavaAppletPlugin.plugin, then the Jar Launcher will use it and ignore anything in /Library/Java/JavaVirtualMachines.
I've solve my problem of version mismatch between the Jar Launcher and the terminal by removing the JRE:
Go to /Library/Internet Plug-Ins.
Remove the JavaAppletPlugin.plugin directory by executing the rm command as a root user or by using the sudo tool.
Go to /Library/PreferencePanes.
Remove JavaControlPanel.prefpane by executing the rm command as a root user or by using the sudo tool.
Source: https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-macos.htm

Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory

I have installed ghostscript of 64 bit on my 64 bit linux machine. I am using ghost4j-0.5.0.jar to convert pdf files to tiff files. I have written a java program which will convert pdf files to tiff files. This is working perfectly fine on Windows but when i thought of moving this to linux machine i am getting the below error.
"Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory"
I checked lib folder and could not find libgs.so file in the lib folder. I am not sure where to get that file.
Can anyone please help me on this ?
I feel a little guilty posting this here since it is probably better served on ServerFault or one of the Linux boards and the question is over 6 months old but I had been banging my head against the wall all day and finally have found a solution to this problem and I figured someone else might benefit from this down the road.
Systems: Windows 7 and CentOS 6.5
Using: Ghostscript 9.14
A little backstory:
Like the OP I had been running a ghostscript program on Windows to convert PDFs to a series of images. This worked fine until I needed to switch over to Linux and run the program and about 5% of the PDFs I needed to convert came up with error cannot decode code stream. I realized that I was using a newer version of ghostscript on Windows. (9.14 on Windows compared to 8.70 on CentOS due to installing through yum).
I removed the old version with yum remove ghostscript. Next, I found the easiest way to install the newest version of Ghostscript is download from here and compile. Since I removed the previous version of ghostscript with yum I had to update the link in usr/bin to point to usr/local/bin/gs with ln -s /usr/local/bin/gs /usr/bin/gs. With everything in place, so I thought, I attempted to run my program and then bam, error!
Solving the problem:
So now I was getting the error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory
I came across a post here that said to get the necessary libgs.so I needed to go back and rebuild the source as a shared library with the command make so. I did so and then I took the libgs.so.9.14 file under sobin directory in the ghostscript folder and copied it to /usr/lib. Under that directory I made a symbolic link to libgs.so using the command ln -s /usr/lib/libgs.so.9.14 /usr/lib/libgs.so.
Once that was done I needed to update my ld_library_path but found when I did so the change wasn't global so I found a Unix & Linux post on how to set the global lib path. Basically to do so you need to go to add a .conf file in /etc/ld.so.conf.d/ with the path to the file. I did so using vi /etc/ld.so.conf.d/libgs.conf and added /usr/lib/libgs.so to the file. Lastly I ran ldconfig so save the changes.
TLDR:
Download the latest version of Ghostscript from source: wget http://downloads.ghostscript.com/public/ghostscript-9.14.tar.gz
Unpack the tar: tar -xzf ghostscript-9.14.tar.gz
cd ghostscript-9.14
./configure
make <-- You might be able to skip and go to make so, I did it in this order so I will leave it like this.
make install
make so
If you removed a previous version with yum ln -s /usr/local/bin/gs /usr/bin/gs
cp ghostscript-9.14/sobin/libgs.so.9.14 /usr/lib
ln -s /usr/lib/libgs.so.9.14 /usr/lib/libgs.so
vi /etc/ld.so.conf.d/libgs.conf
In the new libgs.conf file: /usr/lib/libgs.so and save with esc, :, wq.
ldconfig and done.
Run your conversion program.
Hopefully this helped and wasn't too confusing. I'm not a linux expert (yet) so I may be doing a little more work than necessary with the above commands but I wanted to be thorough.
I just had this issue on a linux VM. I was able to solve it by installing ghostscript on the system. I just used the command:
sudo yum install ghostscript
Hope that helps!
make soinstall will create required libs along with executables as mentioned in https://www.ghostscript.com/doc/current/Install.htm#Shared_object

Eclipse error 'g++/gcc' not found in path

I have installed Eclipse 4.3 Juno. My environment is split into two separate workspaces. One is for Java and one for c/c++.
When I run the eclipse for C I can work with it and compile my projects.
eclipse -data d:\src\c -vmargs -Xmx512M
Now when I run the environment for Java development I suddenly get this error:
error 'g++/gcc' not found in path
The two workspaces are completely separated with their own .metadata directories.
I tried various hints that I found here and via google, like resetting the preferences, but nothing helped. Since I can work with my C environment it should be proof enough that the compiler exists. :) It is also in the PATH variable, so when I use g++/gcc on the windows commandproampt I get access denied (because it's cygwin).
So How can I get rid of this annoying error when I run my eclipse only for Java. I don't even need CDT there, but the plugins are probably installed in eclipse and not in the workspace. So this has to be some path setting or so, which I changed for the C but not for the Java environment.
So finally I found a solution. I got the hint from here Configure Eclipse CDT to use g++
The important bit was the comment that g++ is a symbolic link. Everything was set up ok, but when I executed g++ or gcc from the windows command prompt, I got the error "Access denied" while it worked from within cygwin.
After reading the bit about it being a symbolic link, it was clear what the problam was, because Windows can not cope with it. So what I did now, I reversed the symbolic links such that gcc and g++ is the real exe and the links of g++-3 and so on are pointing now to the exe, instead of the other way around.
I had to restart eclipse using the -clean option, then restarted it normaly and the error is history. :D
You should install the build-essential
sudo apt-get install build-essential
after installing this, open a terminal, and type g++ (hit enter) if it says there is no input, then you got your g++
I mean, eclipse is good but problems like this are persistent I find.
Try giving NetBeans a look in.

How to use google batch upload in linux

I have read this article
http://lifehacker.com/5354441/google-docs-batch-upload-eases-online-document-transfers
java -jar google-docs-upload-1.2.jar /home/kevin/uploads --recursive
now its not working it says bas command not found.
is java already installed in vps centos or i have to install it
Either you don't have java or its not available in your path. Some linux distros install java in the /opt directory. So be sure to check if that's the case with you. If so then its just a matter of updating your path if not then there are two possibilities :
1. You have root access.
2. You don't have root access.
If you do have root access then you can easily install java with your package manager, if now you can still install java as a local user. Read this to do that. You can install any version of java that you so wish, also it may be unnecessary to install JDK, just JRE might be enough for you.
Don't do the steps that need root access, just copy it somewhere in your home directory or any of the directories to which you have access. Then set the appropriate values for JAVA_HOME and your PATH. It should work then.
If you need any help in doing that feel free to ask.
Download the jar google-docs-upload-1.2.jar.
Ensure you have Java.
Use your own home- and upload-folder, not the "kevin/uploads" one.

Categories

Resources