| |

VerySource

 Forgot password?
 Register
Search
Author: xenon1

How to call an unpackaged class under a packaged class

  [Copy link]

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-8-28 14:00:01
| Show all posts
In CMD mode, type JAR the CLASS file and copy the JAR package directly to the LIB file of the project.

Packaging command jar -cvf ****.jar source file
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 14:15:01
| Show all posts
Then don't use package to name your class, put the manufacturer's class and your own class in a folder for use.
Reply

Use magic Report

0

Threads

16

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-8-28 14:45:01
| Show all posts
It doesn't seem to be that simple, hehe.
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 16:45:01
| Show all posts
It may be caused by the incorrect import path of the lz package in the class
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-28 19:15:01
| Show all posts
Won't you pack it yourself? Ha ha!

Or, add the file directory to the CLASSPATH
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 19:45:01
| Show all posts
It’s the lz package name quoted incorrectly, post the code to see that
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 20:00:01
| Show all posts
Just lay down the package and use it just like adding other expansion packages.
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 20:15:01
| Show all posts
Compressed directly into zip format, all files are in the root package, and then directly imported into eclipse lib, OK!
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-28 21:15:01
| Show all posts
Study `````````````````
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-28 21:30:01
| Show all posts
If the host uses eclipse, then you can directly put the jar package under the eclipse project. I am talking about the java project, and then change the properties of the project.
If you are writing in a simple text editor such as Notepad, use the following command
javac Hello.java
java -cp .; Your jar package path is generally placed in the same directory Hello
Absolutely ok
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