| |

VerySource

 Forgot password?
 Register
Search
Author: xenon1

How to call an unpackaged class under a packaged class

  [Copy link]

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 11:00:01
| Show all posts
You can put all the class files in a folder (such as classdir), and then use
jar -cvf jarname.jar classdir - generate jar package
Then put the generated jar package in the WEB-INF\lib directory.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 11:15:01
| Show all posts
Use eclipse's packaging tool to mark these compiled unpackaged class files into a jar package. Put this jar package in the lib directory to call it.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 11:45:01
| Show all posts
You can type all compiled unpackaged files provided by those manufacturers into jar packages with tools, and then put the jar packages in the lib directory.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 12:00:01
| Show all posts
Make a jar package and place it in the lib directory.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 12:15:01
| Show all posts
[Quote=Quote the reply of 2tnt03312 on the 2nd floor:]
You can use fat to package those class files yourself
[/Quote]
Reply

Use magic Report

1

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-8-28 12:30:01
| Show all posts
It's better to have some way to put them under a certain package. Using non-packaged classes is quite a headache. What manufacturer are you? Do nothing authentic.
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 13:00:01
| Show all posts
Type into a jar package and import it into the lib directory of your project, as follows:
jar -cvf testjar.jar The folder of the manufacturer category will generate a testjar.jar file, which looks very similar to the zip file, and then introduce your project lib!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 13:15:01
| Show all posts
There seems to be a problem with putting it in the folder. The point is that the source file given by the manufacturer does not declare the package under this folder at all. I ask because you can only put the files of the class in the lib under your project.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 13:30:01
| Show all posts
After learning~~~~~ Can you give me an example of this situation? This situation seems to have never been encountered before (just learning java for two months)
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 13:45:02
| Show all posts
No bag? I haven't encountered this situation yet.

But you can do this. When running, you can package the classes of third-party vendors in the bin or class directory, and you can access them.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list