CN110532037A - A kind of Java operation method, system and terminal - Google Patents

A kind of Java operation method, system and terminal Download PDF

Info

Publication number
CN110532037A
CN110532037A CN201910758496.1A CN201910758496A CN110532037A CN 110532037 A CN110532037 A CN 110532037A CN 201910758496 A CN201910758496 A CN 201910758496A CN 110532037 A CN110532037 A CN 110532037A
Authority
CN
China
Prior art keywords
class
loaded
path
definition
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910758496.1A
Other languages
Chinese (zh)
Inventor
李元佳
张优杨
郭逸重
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Yunqian Technology Co Ltd
Original Assignee
Hangzhou Yunqian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Yunqian Technology Co Ltd filed Critical Hangzhou Yunqian Technology Co Ltd
Priority to CN201910758496.1A priority Critical patent/CN110532037A/en
Publication of CN110532037A publication Critical patent/CN110532037A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention relates to field of computer technology, a kind of java applet operation method, system and terminal, a kind of java applet operation method include: that the class obtained under agreement path defines list;Class in list is defined and is ranked up according to custom rule;It is judged whether or not class to be loaded defines;Class to be loaded definition completes loading classes then using such definition if it exists;Class to be loaded definition if it does not exist continues to search class definition to be loaded.Method of the present invention may be implemented in Java programming, the real time modifying of operation logic.

Description

A kind of Java operation method, system and terminal
Technical field
The present invention relates to field of computer technology, and in particular to a kind of java applet operation method, system and terminal.
Background technique
Java is the language being commonly used in programming, but compared to comparing the dynamic languages such as Python or Php. Dynamic realtime modification ability is weaker always in the process of running for java applet.
Dynamic change mechanism when a kind of new operation exists in the prior art, as long as according to the path rule of agreement to placement The Jar packet of latest edition, can be realized the real time modifying of operation logic, and so-called Jar file is the packaging of Java binary Form, after java class is compiled, boil down to extends the file of entitled Jar, for providing corresponding function.Java applet needs should Function, the class being loaded in Jar file.Jar file is applied not only to compress and issue, but also for disposing and encapsulating Library, component and plug-in card program, and can directly be used by the tool as compiler and Java Virtual Machine.Although having there is dynamic The schemes such as agency or bytecode modification reach similar effect, but developer is required to realize that dynamic proxy even modifies bytecode, skill Art requires high.
CN102081523A discloses a kind of dynamic loading system, the dynamic loading system include packet generation module, File uploading module and dlm (dynamic loading module).If system Classloader not successfully beat by load in the dlm (dynamic loading module) APMB package, then 1 Classloader can be attempted to load the packaging file, if 1 Classloader can not be loaded successfully, 2 Classloaders It attempts to load.But without the processing logic for proposing load.
In order to solve the above problem, the present invention provides a kind of java applet operation method, system and terminals, relative to existing Technology, the entire logic that handles are more easier to operate, be easily used.
Summary of the invention
Present invention solves the technical problem that being to provide a kind of java applet operation method, system and terminal.Described one Kind java applet operation method and system may be implemented in Java programming, the real time modifying of operation logic.
In order to solve the above technical problem, the present invention provides technical solution are as follows:
A kind of java applet operation method characterized by comprising
The class obtained under agreement path defines list;
Class in list is defined and is ranked up according to custom rule;
It is judged whether or not class to be loaded defines;
Class to be loaded definition completes loading classes then using such definition if it exists;
Class to be loaded definition if it does not exist continues to search class definition to be loaded.
Preferably, the custom rule includes: path, filename, the custom rule of time.The rule of agreement can With customized, but to be that path, filename, time carry out customized for general rule, but is not limited to the customized of these three.
Preferably, the method for continuing to search class to be loaded and defining are as follows:
Judge whether current path has been searched to finish;
It is searched in the path of next priority if lookup is finished;
If finding class to be loaded, returns and judge whether current path has class definition to be loaded;
If not finding class to be loaded, class is prompted to be not present.
Preferably, the class loaded includes timing renewal process.The timing renewal process can be every finger It fixes time, whether automatically scanning is arranged the file under path and changed, compare and born the same name if finding file with the class loaded, born the same name Then existing class in jvm is replaced using newest definition to define.
Preferably, the timing renewal process are as follows:
Obtain the path list of agreement;
Compare the path list scanned;
Judge whether two lists are variant;
If indifference completes new route scan task.
Preferably, described to judge whether two lists variant, if judge it is variant if:
Newly-increased path is ranked up according to custom rule;
The class obtained under newly-increased path defines list;
Judge that the class under newly-increased path defines whether to have loaded;
If having loaded the existing class of replacement to define and save the path list scanned;
Complete the scan task of new route.
Preferably, if the class definition judged under newly-increased path does not load, include:
Judge whether newly-increased path has searched to finish;
Continue to search if not searching and finishing the next newly-increased path of processing;
If finding out loading classes, returns and judge that the class under newly-increased path defines whether to have loaded;
If not finding out loading classes, path scan task is completed.
A kind of java applet operating system, comprising:
Class defines list and obtains module: the class defines list and obtains module for obtaining the class definition column under agreement path Table;
Customized sorting module: the customized sorting module is used to define the class in list and be carried out according to custom rule Sequence;
Judgment module: the judgment module is used for it is judged whether or not class to be loaded defines;Class to be loaded if it exists Definition then using such definition, completes loading classes;It is fixed to continue to search class to be loaded for class to be loaded definition if it does not exist Justice.
Preferably, the java applet operating system further includes the class update module loaded, the loading classes The process of update module update loading classes are as follows:
Obtain the path list of agreement;
Compare the path list scanned;
Judge whether two lists are variant;
If indifference completes new route scan task.
Described judges whether two lists variant, if judge it is variant if:
Newly-increased path is ranked up according to custom rule;
The class obtained under newly-increased path defines list;
Judge that the class under newly-increased path defines whether to have loaded;
If having loaded the existing class of replacement to define and save the path list scanned;
Complete the scan task of new route.
If the class definition under the newly-increased path of the judgement does not load, include:
Judge whether newly-increased path has searched to finish;
Continue to search if not searching and finishing the next newly-increased path of processing;
If finding out loading classes, returns and judge that the class under newly-increased path defines whether to have loaded;
If not finding out loading classes, path scan task is completed.
A kind of computer readable storage medium, the computer-readable recording medium storage have computer program instructions, should Program instruction is suitable for being loaded by processor and executing a kind of java applet operation method.
A kind of mobile terminal, including processor and memory, the processor are used to execute to store in memory Program, to realize a kind of java applet operation method.
Compared with prior art, the device have the advantages that are as follows: use customized java class loader, work as Jvm Load and when using some class, customized class load the path understood according to appointing, preferentially load it is legal most New class.Non- loading classes obtain latest edition when in use.Every specified time, automatically scanning is arranged the file under path and is changed, It compares and whether is born the same name if finding file with the class loaded, bear the same name and then replace existing class in Jvm using newest definition Definition.The rule of agreement can be customized, including but not limited to path, filename, modification time etc..This scheme can not only be applied In the modification of code, by the adjustment to loading rule, the safety check for treating loading content could be applicable to, to realize core The safeguard protection of heart service code.Entire processing logic of the present invention is more easier to operate, and is easily used.In this programme In, developer can attentively develop fresh code completely, it is only necessary to which this scene is greatly reduced in the path for considering newest operation packet Under requirement to developer.
Detailed description of the invention
Present invention will be further explained below with reference to the attached drawings and examples.
Fig. 1 is a kind of flow diagram of java applet operation method of the present invention;
Fig. 2 is a kind of loading classes timing update method flow chart of the present invention;
Fig. 3 is a kind of structure chart of java applet operating system of the present invention.
Specific embodiment
In conjunction with the accompanying drawings, the present invention is further explained in detail.These attached drawings are simplified schematic diagram, only with Illustration illustrates basic flow chart of the invention, therefore it only shows process related to the present invention.
Embodiment 1
As shown in Figure 1, the present invention is a kind of java applet operation method, the method specifically:
S1. the class obtained under agreement path defines list;
S2. the class in list list is defined to be ranked up according to custom rule;
S3. it is judged whether or not class to be loaded defines;
S4. class definition to be loaded completes loading classes then using such definition if it exists;
S5. class definition to be loaded if it does not exist, continues to search class definition to be loaded.
Wherein illustrate, the JVM (Java VirtualMachine), claims Java Virtual Machine, java generation can be run The virtual machine of code, as long as interpreter is transplanted on specific computer according to JVM specification representation, it is ensured that by compiling Any java code translated can be run on this system, and JVM possesses oneself perfect hardware, such as processor, storehouse, register Deng, and also there is corresponding instruction system.
Java class loader, java program include many class files, and java class loaders are not depended on from class file acquisition They are loaded into the operation of JVM memory headroom by the bytecode of platform.
The Jar file: the same repository comprising multiple java class files and related resource.It is java program assembly A kind of common version of distribution.
Method of the present invention be using customized java Classloader, when jvm is loaded and when using some class, Customized class, which has loaded, preferentially to load legal newest class according to the path appointed.Every specified time, certainly Whether the file under dynamic scanning agreement path changes, compare and born the same name if finding file with the class loaded, born the same name then using most New definition replaces existing class definition in jvm.Non- loading classes obtain latest edition when in use.Concrete implementation method is as follows Process is realized:
Step S1: the class obtained under agreement path defines list, obtains the class definition for including under specified path.
Step S2: the class in list is defined into list and is ranked up according to custom rule.Custom rule include path, Loading classes are ranked up by filename, the customized of time, and the rule of this agreement can be customized, enumerate path, text herein Part name or modification time, but it is not limited to these three.
Step S3: it is judged whether or not class to be loaded defines.Class to be loaded is run first, wherein the class After compiled, boil down to extends the file of entitled Jar, for providing corresponding function.
Step S4: class to be loaded definition completes loading classes then using such definition if it exists.
Step S5: class to be loaded definition if it does not exist continues to search class definition to be loaded.It is described continue to search to The method that the class of load defines are as follows: judge whether current path has been searched and finish;If lookup is finished in next priority It is searched in path.Described after lookup, returns to judgement if having class definition to be loaded and works as in the path of next priority Whether preceding path has class definition to be loaded.
Using customized java Classloader, when jvm is loaded and uses some class, customized class has loaded meeting According to the path appointed, legal newest class is preferentially loaded.Non- loading classes obtain latest edition when in use.This scheme The not only modification of applicable code could be applicable to the safety check for treating loading content by the adjustment to loading rule, To realize the safeguard protection of core business code.
Embodiment 2
The class loaded includes timing renewal process, is illustrated in figure 2 the stream of the timing renewal process of the class loaded Journey schematic diagram, the process that the timing updates are as follows:
Obtain the path list of agreement;
Compare the path list scanned;
Judge whether two lists are variant;
Indifference completes new route scan task.
Described judges whether two lists variant, if judge it is variant if:
Newly-increased path is ranked up according to custom rule;
The class obtained under newly-increased path defines list;
Judge that the class under newly-increased path defines whether to have loaded;
If having loaded the existing class of replacement to define and save the path list scanned;
Complete the scan task of new route.
If the class definition under the newly-increased path of the judgement does not load, include:
Judge whether newly-increased path has searched to finish;
Continue to search if not searching and finishing the next newly-increased path of processing;
If finding out loading classes, returns and judge that the class under newly-increased path defines whether to have loaded;
If not finding out loading classes, path scan task is completed.
By the way that every specified time, automatically scanning is arranged the file under path and is changed, compared if finding file whether with The class loaded is born the same name, and is born the same name and is then replaced existing class definition in jvm using newest definition, realizes automatically updating for class Process.
Embodiment 3
As shown in figure 3, the present invention provides a kind of systems:
Class defines list and obtains module 1: the class defines list and obtains module for obtaining the class definition column under agreement path Table;
Customized sorting module 2: the customized sorting module be used for by list class definition according to custom rule into Row sequence;
Judgment module 3: the judgment module is used for it is judged whether or not class to be loaded defines;Class to be loaded if it exists Definition then using such definition, completes loading classes;It is fixed to continue to search class to be loaded for class to be loaded definition if it does not exist Justice.
The java applet operating system further includes the class update module loaded, the loading classes update module Update the process of loading classes are as follows:
Obtain the path list of agreement;
Compare the path list scanned;
Judge whether two lists are variant;
If indifference completes new route scan task.
Described judges whether two lists variant, if judge it is variant if:
Newly-increased path is ranked up according to custom rule;
The class obtained under newly-increased path defines list;
Judge that the class under newly-increased path defines whether to have loaded;
If having loaded the existing class of replacement to define and save the path list scanned;
Complete the scan task of new route.
If the class definition under the newly-increased path of the judgement does not load, include:
Judge whether newly-increased path has searched to finish;
Continue to search if not searching and finishing the next newly-increased path of processing;
If finding out loading classes, returns and judge that the class under newly-increased path defines whether to have loaded;
If not finding out loading classes, path scan task is completed.
The present invention also provides a kind of computer readable storage medium, the computer-readable recording medium storage has computer Program instruction, the program instruction are suitable for being loaded by processor and executing a kind of java applet operation method.
The present invention also provides a kind of mobile terminal, including processor and memory, the processor is deposited for executing The program stored in reservoir, to realize a kind of java applet operation method.
Above-listed detailed description is illustrating for possible embodiments of the present invention, and above embodiments are not to limit this The scope of the patents of invention, all equivalence enforcements or change without departing from carried out by the present invention, is intended to be limited solely by the scope of the patents of this case.

Claims (10)

1. a kind of java applet operation method characterized by comprising
The class obtained under agreement path defines list;
Class in list is defined and is ranked up according to custom rule;
It is judged whether or not class to be loaded defines;
Class to be loaded definition completes loading classes then using such definition if it exists;
Class to be loaded definition if it does not exist continues to search class definition to be loaded.
2. a kind of java applet operation method according to claim 1, which is characterized in that described continuing to search is to be loaded The method that defines of class are as follows:
Judge whether current path has been searched to finish;
It is searched in the path of next priority if lookup is finished;
If finding class to be loaded, returns and judge whether current path has class definition to be loaded;
If not finding class to be loaded, class is prompted to be not present.
3. a kind of java applet operation method according to claim 1, which is characterized in that the class loaded includes Timing renewal process.
4. a kind of java applet operation method according to claim 3, which is characterized in that the timing renewal process Are as follows:
Obtain the path list of agreement;
Compare the path list scanned;
Judge whether two lists are variant;
If indifference completes new route scan task.
5. a kind of java applet operation method according to claim 4, which is characterized in that described two lists of judgement are It is no variant, if judge it is variant if:
Newly-increased path is ranked up according to custom rule;
The class obtained under newly-increased path defines list;
Judge that the class under newly-increased path defines whether to have loaded;
If having loaded the existing class of replacement to define and save the path list scanned;
Complete the scan task of new route.
6. a kind of java applet operation method according to claim 5, which is characterized in that if described judge newly-increased path Under class definition do not load, then include:
Judge whether newly-increased path has searched to finish;
Continue to search if not searching and finishing the next newly-increased path of processing;
If finding out loading classes, returns and judge that the class under newly-increased path defines whether to have loaded;
If not finding out loading classes, path scan task is completed.
7. a kind of java applet operating system characterized by comprising
Class defines list and obtains module: the class defines list and obtains module for obtaining the class definition column under agreement path Table;
Customized sorting module: the customized sorting module is used to define the class in list and be carried out according to custom rule Sequence;
Judgment module: the judgment module is used for it is judged whether or not class to be loaded defines;Class to be loaded if it exists Definition then using such definition, completes loading classes;It is fixed to continue to search class to be loaded for class to be loaded definition if it does not exist Justice.
8. a kind of java applet operating system according to claim 7, which is characterized in that the java applet runs system System further includes the class update module loaded.
9. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer journey Sequence instruction, which is suitable for by processor load and perform claim requires 1 ~ 6 described in any item methods.
10. a kind of mobile terminal, which is characterized in that including processor and memory, the processor is for executing storage The program stored in device, to realize the described in any item methods of claim 1 ~ 6.
CN201910758496.1A 2019-08-16 2019-08-16 A kind of Java operation method, system and terminal Pending CN110532037A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910758496.1A CN110532037A (en) 2019-08-16 2019-08-16 A kind of Java operation method, system and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910758496.1A CN110532037A (en) 2019-08-16 2019-08-16 A kind of Java operation method, system and terminal

Publications (1)

Publication Number Publication Date
CN110532037A true CN110532037A (en) 2019-12-03

Family

ID=68663437

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910758496.1A Pending CN110532037A (en) 2019-08-16 2019-08-16 A kind of Java operation method, system and terminal

Country Status (1)

Country Link
CN (1) CN110532037A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101174217A (en) * 2007-11-22 2008-05-07 上海交通大学 Method for implementing dynamic update of Java program
CN102073525A (en) * 2011-01-20 2011-05-25 中兴通讯股份有限公司 Method and device for dynamically upgrading Web service system based on Java platform
US20120222023A1 (en) * 2011-02-24 2012-08-30 Red Hat, Inc. Automatic runtime dependency lookup
CN102929597A (en) * 2012-09-24 2013-02-13 摩卡软件(天津)有限公司 Java-platform-based web service support method and device
CN106980512A (en) * 2017-05-15 2017-07-25 中国建设银行股份有限公司 Update the system and method for JAVA application services

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101174217A (en) * 2007-11-22 2008-05-07 上海交通大学 Method for implementing dynamic update of Java program
CN102073525A (en) * 2011-01-20 2011-05-25 中兴通讯股份有限公司 Method and device for dynamically upgrading Web service system based on Java platform
US20120222023A1 (en) * 2011-02-24 2012-08-30 Red Hat, Inc. Automatic runtime dependency lookup
CN102929597A (en) * 2012-09-24 2013-02-13 摩卡软件(天津)有限公司 Java-platform-based web service support method and device
CN106980512A (en) * 2017-05-15 2017-07-25 中国建设银行股份有限公司 Update the system and method for JAVA application services

Similar Documents

Publication Publication Date Title
US9430224B2 (en) Hot-update method and apparatus
CN106371940B (en) Method and device for solving program crash
CN100414503C (en) Apparatus and methods for restoring synchronization to object-oriented software applications in managed runtime enviroments
US5367683A (en) Smart recompilation of performing matchup/difference after code generation
US10795659B1 (en) System and method for live patching processes in user space
CN101040260A (en) Platform independent dynamic linking
CN106648755B (en) Method and device for dynamically loading dex in android art environment
US9411617B2 (en) System and method for matching synthetically generated inner classes and methods
CN112685410B (en) Business rule checking method, device, computer equipment and storage medium
CN1813243B (en) Apparatus and methods for desynchronizing object-oriented software applications in managed runtime environments
US9098355B2 (en) Method and apparatus for substituting compiler built-in helper functions with machine instructions
CN111796829A (en) Applet updating method and device, electronic equipment and computer readable storage medium
US7472380B1 (en) Processing system with component architecture platform support
US5446899A (en) Hint generation in smart recompilation
US9841982B2 (en) Locating import class files at alternate locations than specified in classpath information
CN105335185B (en) Red cap source code assures the processing method and processing device of reason SRPM packet
US10310870B2 (en) Method for creating a revised application by adding code functionality to an existing application executable
US5535392A (en) Using hint generation to cause portions of object files to remain the same
CN110532037A (en) A kind of Java operation method, system and terminal
CN108460276B (en) Processing method and device for SO file of dynamic link library of android installation package
CN111061642B (en) Full-automatic competition data processing system and method based on user data
CN114564228A (en) Application program updating method and device, computer equipment and storage medium
CN113050948A (en) Dynamic library optimization method, device, equipment and storage medium
KR102070010B1 (en) Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions
CN113672238B (en) Operation method, device and equipment based on real-time operating system modularized management

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191203