K
K
kononov9712020-05-09 17:03:58
Java
kononov971, 2020-05-09 17:03:58

How to create a jar archive in Idea?

I need to create a class archive with two methods. When trying to create an archive via Project Structure → Artifacts, Idea creates an archive with a modified class: an empty constructor is created, foreach loops are replaced with iterators. How to create an archive without changing the original class?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2020-05-09
@kononov971

No way. And Idea has nothing to do with it. This is the work of the Java compiler, and is fixed by the standard of the language and the virtual machine.

X
X-nautilus, 2020-05-15
@X-nautilus

The jar stores the code already compiled into .class files.
And things like foreach, lambda... are called syntactic sugar, created for ease of writing, but in . Class java parses them.
For example lambda would be a nested class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question