Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing Java Packages

Tags:

java

package

I have a question concerning storing packages in Java.

Usually, we assume that packages are stored in a local file system and each file should have only one public class or interface.

But this is not the case for packages stored in a "some sort of database".

It is written in Java SE 8 specification:

"In simple implementations of the Java SE platform, packages and compilation units may be stored in a local file system. Other implementations may store them using a distributed file system or some form of database."

see section 7.2 in the JLS.

Usually, we download Java SE as a simple exe-file (for Windows case) and this file installs a set of folders and files into local file system. This we name "Java SE installation".

Do you know, is there a "Java SE installation" for the "database case"? Or do you have any idea how it could be implemented?

like image 911
Vitaly Avatar asked Aug 23 '26 10:08

Vitaly


1 Answers

It looks like I understood the problem.

1) First of all yes, they leave the details of implementing the feature up to Java implementor.

2) Compilation units are the "food" of Java Compiler (javac.exe) rather than JVM (java.exe) and we specify this "food" like

javac MyClass.java

and in -sourcepath option. All of this stuff are files (java-files, folders, jar/zip files).

3) From my point of view "Database Java SE" would have an option to directly connect to the database and fetch sources from tables and push back to the database compiled binary code.

For example javac_db "fetch sources from db" "post binary code to db"

4) Regarding applets on the server. The fact is that applets are stored in the server as a binary class-files and hence they are not the "food" for compiler. Usually they are stored as separate class-files or in jar/zip files.

5) Regarding auto-generated Java code like compiled JSP-pages. When we transform JSP page to the servlet we create Servlet source in memory but before compiling it we serialize it to a file and then send to the javac.exe. Hence we deal with files here.

Hence "Database Java SE" mainly concerns Java Tools like "java_db.exe", "javac_db.exe" etc.

like image 174
Vitaly Avatar answered Aug 26 '26 01:08

Vitaly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!