I'm doing the Ludum Dare 25, using Java Libgdx trying to export my jar.
It was working absolutely fine earlier, I exported and could run it fine. Now when I export it the exact same way, it crashes as soon as I open it. Running via CMD I get the error
'Could not find or load main class'
I've opened it up in winrar and checked the Main class is there and the manifest points to the correct place. I don't understand what's wrong.
All help appreciated, many thanks!
Solution Found
Odd issue, despite the error message had nothing to do with the class, the jar exporter made one of my image files lowercase or something, so that it was messing up it's references
Related
I've found a bunch of Stack Overflow Questions and Answers, but so far I haven't found any that work for me. I am trying to make an executable jar in Eclipse from a program which requires an extra jar and a dll. The way I got this to work properly in Eclipse is by configuring the Build Path as shown in
this image. The hierarchy of the project is this. I've tried messing with the Manifest file a bit, but I haven't made any progress with that.
I've been running the jar by using java -jar /path/to/jar and I keep getting an error saying Exception in thread "main" java.lang.NoClassDefFoundError: com/jacob/activeX/ActiveXComponent .... I've tried defining a path to the jar using -Djava.library.path=/path/to/jar and I get an error saying Error: Could not find or loaded main class outlook_dl_2.jar.
Is there any way to solve this without using a third-party application like One JAR? That's the only thing I can find that I haven't tried and I'm trying to avoid it if possible, since I feel like it really shouldn't be necessary. I'll use it as a worst-case scenario, but I would like to get this working without it.
Anyone know what I'm doing wrong here?
I am working on a program for a hacking to for FNAF 1 & 2, and for some reason, when I run the program in eclipse, it works just fine, but when I export it, it refuses to run because it says the file is missing, and when I check the jar file, all of the files are there. So, why is this happening?
If you need a class file, Please let me know, normally, I would post it, but it seems like a classpath error I seem to be making.
I exported a Java project of mine from Eclipse to a JAR File, and after searching the internet for an hour, have still not resolved my problem. The jar file works on the computer that I compile, and exported it on, yet when I transfer it to my laptop it states that "A Java Exception has occurred" when I try to double click it, and when I run the code below, it retorts "Error: Could not find or load main class jar"
java -jar C:\Users\Me\Desktop\test.jar
I exported it once more after specifying to the MANIFEST.MF the location of my main class, yet the same error is being reported. I have seen the MANY other threads on this on this forum, yet the advice has either been too vague or just plain didn't work.
Thank you in advance.
Check the version of java you are running in your laptop, the error could present itself if you compiled your program with a different version that the one you are using to run it.
I have a problem with vlc.I am using Eclipse and have made a small application to play video files using vlcj framework.Inside Eclipse everything works fine but when I make jar executable file through Eclipse and double-clicking it (on Windows 64: Tested only on this platform) nothing happens .Then I'm trying using "cd myjarfilepath" and then "java -jar myjarname.jar" and everything works fine.Why this is happening and how to solve it?
Thanks in advance to stackoverflow's community .
Edit:
In Path Location: C:\Users\user\Documents\31\Latest_Win64\Needed I have the following files:
plugins(directory)
axvlc.dll
axvlc.dll.manifest
libvlc.dll
libvlc.dll.manifest
libvlccore.dll
npvlc.dll
npvlc.dll.manifest
vlc.exe.manifest
In my classpath i have included the following files:
jna-3.5.1.jar
platform-3.5.1.jar
vlcj-2.2.0.jar
vlcj-2.2.0-javadoc.jar
vlcj-2.2.0-sources.jar
This sounds like an issue loading the needed VLCj files. Not only are dlls required but the plugin directory is also required. As the execution location moves around from inside eclipse to back in the file system, the path to these files may be getting set incorrectly.
It sounds like you have it working within eclipse. This would indicate to me that what you have should work. Firstly, I would recommend acquiring the VLC dlls, etc., by providing this as a VM argument such as shown below, rather that setting it in code. Remember to comment out any loading you are doing in your code so that you are relying on the command line argument.
-Djna.library.path={Application Location}/lib
example: -Djna.library.path=C:/myapp/lib
Directory Contents:
lib
-- libblc.dll
-- libvlc5.dll
-- {etc}
/plugins
/3dnow
/access
{etc}
If you are still having issues, add the following argument to put VLCj into debug mode. This can be very helpful to determine where things are failing.
-Dvlcj.log=DEBUG
Hope that helps.
I am working on Java project (A terraria like sandbox game) and I have come across something that I just don't understand. I have been exporting the project as .jar's as I go along to upload and share with my friends, but the last time I did this, the .jar won't run, but when I run it in eclipse, it runs fine. When I try to run the jar all it does is lose focus on the explorer window for a split second, then goes back. I have tried many things, like changing the main class, changing the META, and moving the files to specific packages, but nothing is working.
The project is 9 classes, so I won't paste all the code for it here, but the latest, non-working source code can be found here (http://www.mediafire.com/?fiw6wq73j7cff4t), the non-working jar here (http://www.mediafire.com/?bhjo162oh3hi2j9), and the working jar here (http://www.mediafire.com/?h918s8xpyxw4psr). If someone with more experience in java could please take a look at this it would be much appreciated.
One of the things I tried was not adding the JPanel (the game), and just leaving the splash screen, and the jar worked. This shows that it must be a problem in the coding somewhere.
Thanks for the time,
I.D.
Couldn't find message comes from your ReadMap class. So check which circumstance leads to this error. Most likely you did not add all classes or other files to your JAR, so file is not found. Check that all needed files are added to exported JAR in Eclipse export dialog. It's also a good idea to provide more debugging info (stacktrace is ok), especially when you are studying. BTW, cool game :)