This content has been marked as final. Show 11 replies
dford425 wrote:No, not unless you package the JRE with your dist. Hence the name JRE (Java Runtime Environment).
First i have a question, can i make a .jar file that can run on a computer without JRE installed.
And if i can, how do i make it. I have tried to make it on my computer, that has JRE but i keep getting the error when i run it:That simply means your not pointing the runtime to the classes. Set your CLASSPATH environment variable correctly and it will run (given you have a JRE which it appears you do).
Exception in thread "main" java.lang.NoClassDefFoundError: Sample\FileSearch
And im using the command:
It says it creates the .jar but is unable to run it.
jar cvfm jarname.jar directory\manifest.txt directory\FileSearch.class directory\FileNode.class
dford425 wrote:Okay, all of that is wrong. This is one of the first things you learn in Java.
Here is the command i use to set the classpath
dford425 wrote:So presumably you really wanted to ask why it doesn't work when you use the command... something I don't see anywhere in the thread.
What is wrong with my classpath?
And if my classpath is wrong, why does it work when i use the command
And when I asked earlier whether you really had a backslash in your error message, the answer "Yes, there's a *slash*" means you don't get it. Let me spell out the name of keys:
Now, did you really have a backslash in your error message?
No it does work when use the comman java FileSearch. If that works, that should mean my CLASSPATH is set correctly.
And yes i did have a backslach in my error message. The manfest file had this one line:
But if change the manifest to:
There is no backslash in my error.
I don't have my file with me but there is a little program out there called fixmyjarfile, or something, do a internet search for fix or make jar file bootable, you will find it, then run it on the jar file and it corrects the manifest, I have the same problem, and I just use this program to fix it, or you can use jsmooth to make a windows exe file to ran it.
hope this helps.