-3

Trying to execute my project, I meet an error that starts with main(Unknown Source) and then propagates through the code. I think that in the brackets there should be written the line of code where the error is.

I must clarify that my code is already deployed so I've got only .class file.

Jiri Tousek
  • 12,211
  • 5
  • 29
  • 43
  • Please share some code for us to see what can be missing! Even if the code is deployed... Also, check in the console what can give you – M.K Oct 18 '18 at 07:16
  • @M.K I feel that asking for the code is somewhat out of place here since OP explicitly states they don't have it. – Jiri Tousek Oct 18 '18 at 07:20
  • Please read "How to create a [mcve]". Then use the [edit] link to improve your question (do not add more information via comments). Otherwise we are not able to answer your question and help you. – GhostCat Oct 18 '18 at 07:21
  • @JiriTousek As for what my knowledge reaches (probably not that much), I think I need something more so I can check and see where the error is coming from, so I can try and help as much as I can. But if he/she only has the .class file, probably you are right. – M.K Oct 18 '18 at 07:23
  • Maybe the first point here is: do you understand what a java stack trace is? – GhostCat Oct 18 '18 at 07:30
  • I rewrote the question's title to what I *think* you're asking about. Please feel free to revert if that's not what you meant to ask about. And if your question is "why is it printing an error" rather than "why is it not printing line numbers", then we need much more info as others pointed out - even if you don't have source code, at least add the full error to the post, and on what kind of inputs it prints the error and on what inputs it runs ok. – Jiri Tousek Oct 18 '18 at 07:34

1 Answers1

2

If you (or anyone else) compiled the classes without debug symbols (javac -g option), you won't see the line numbers.

You can verify whether this is the cause using javap -v.


That said, if you don't have the source code, how would knowing the line number help you? Either you'll be able to find the cause for the error from the error message itself, or you'll have to get the source code somehow (find someone who has it or disassemble the class file). Hopefully main will be short enough for you to be available to determine where the error occurred even without the line number.

Jiri Tousek
  • 12,211
  • 5
  • 29
  • 43