I often need to fix some java projects and the most annoying problem is searching libraries to import in order to compile jar. And is there a way to ignore missing libraries and normally compile java-project in eclipse?
Asked
Active
Viewed 1,162 times
-4
-
Perhaps you should consider converting your projects to use a dependency manager, such as maven. – azurefrog Sep 11 '17 at 19:25
-
There is no way to ignore these errors. Eclipse (or just javac) needs all the dependencies to compile cleanly. – greg-449 Sep 11 '17 at 20:18
-
This is why Maven was invented! You might also steal the libraries from the previous deployment location on the production machines. – Thorbjørn Ravn Andersen Sep 13 '17 at 20:00
1 Answers
-1
No. Short of removing the dependency on the needed libraries you cannot compile without them. Take a look here for How external libraries work
However eclipse can automatically fix missing imports. Ctrl + Shift + O
Edit: i think i understand better what you're saying now, and i change my answer to Yes! kinda. Depending on the import you could replace it with fully qualified names. Doing this should generate identical bytecode. See here

axwr
- 2,118
- 1
- 16
- 29
-
But import way in bytecode is written just as simple string, why we cant ignore missing library and just to write the way (thinking we imported lib)? – LuckyZeeRo Sep 11 '17 at 19:21
-
1
-
You import for example "com.example.project.File" class If library is in build path (in eclipse) there is no errors and we can compile it. The result is the bytecode with this "com.example.project.File". What is the problem we can't ignore missing library in build path and compile (writing in bytecode missing import)? – LuckyZeeRo Sep 11 '17 at 19:27
-
I think i understand, yes you could replace everything with the fully qualified name, basically undoing the shorthand that the imports provide and you should wind up with identical bytecode. I don't recommend this since the shorthand is there for a reason but it would work. – axwr Sep 11 '17 at 19:31
-
I think you didn't understand me. I have some imports such as: import jline.TerminalSupport; import jline.UnsupportedTerminal; import jline.console.ConsoleReader; And of course some code, linked to this imports. But I have not included Jline jar in eclipse build path. What is the way to compile the project without searching this jar in google and including in build path? And make project working (without eclipse error compile exception replacement) – LuckyZeeRo Sep 11 '17 at 19:39
-
@Scheme Just using full names will not fix the errors because the compiler needs to know everything about the class - what does it extend, what does it implement, what methods does it have, what are the declarations of the methods, what other types does it use, ...... – greg-449 Sep 11 '17 at 20:34