Reputation: 1462
I am trying to create a Runnable Jar file for my java project. I am using Eclipse Kepler to do so but after creating the jar file i am getting some warning message from the Eclipse. I tried to find the answer on google but got nothing. I am not able to copy paste the error message which i received from the eclipse so i am attaching the screen shot of it.
But i am able to use that jar file without any warning.
Upvotes: 0
Views: 4934
Reputation: 20520
When Java (and hence Eclipse) compiles a .java
file, it might work with no problems, or it might produce warnings or errors. If you get errors then it means that the file couldn't be compiled: you have to fix the errors before you can run your program. But warnings are different: they let you know that you've done something suspicious that usually indicates a mistake, but since what you wrote was valid Java according to the syntax, the warnings didn't stop the compilation, and you'll be able to run your program.
If a file has errors in it, then there will be a red cross placed in the project explorer view, superimposed over the icon for the file. There will also be red crosses down the right-hand side of the editor pane for that file, telling you where the errors are.
If there are warnings, then there will be a tiny yellow triangle instead, and also yellow triangles down the right-hand side of the editor pane. But they're fairly inconspicuous, and you won't necessarily notice them unless you know to look for them.
What's going on in your case is that you're building a runnable jar file out of a project that contains some warnings but no errors. What you're seeing is a list of files that have compiler warnings. You can check this by going back to your project explorer pane and looking to see which files have yellow triangles. The reason you've noticed the warnings at this point is that you get hit with a big yellow triangle when you export to a jar file, rather than the tiny yellow triangles that were there before. The big yellow triangle is no more, or less, significant than the tiny yellow ones.
So you should expect your jar file to run, but you shouldn't think that means you can completely ignore the warnings. You will need to check each one carefully, and see whether the warnings are indicative of problems or not. If you want to write good code, it's good to get into the habit of making sure that you eventually get rid of all the compiler warnings in your source.
Upvotes: 3