PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 26, 2022

[FIXED] Why can't a Java application load library binaries from its own .jar?

 September 26, 2022     binaries, java, libraries     No comments   

Issue

While looking for a way for my Java project to load library binaries that are packed with the project, I see several people stating things like:

before you can use the DLLs you need to actually extract these from the JAR and dump these on the hard disk somewhere otherwise you won't be able to load these

Is this statement true? And why?


Solution

DLL (dynamic link libraries) are operating system specific. The operating system needs to be able to directly find the files in order to load them. A jar file is essentially a zip file and the operating system does not go hunting inside of zip/jar files to find DLLs.

In order for the operating system to find a DLL it needs to be accessible directly on the file system, and also in the DLL path for the OS.

Note that jars are Java specific entities, and Java is distinct from the operating system. By depending on an OS-specific DLL (or .o file in Linux) you are restricting your program to work on operating systems compatible with the library - even the bitness (32bit or 64bit) would matter for a DLL.

That being said, if you do need to include and use DLLs, then you'll need some kind of installation procedure or instructions to get the files in place before being able to run.



Answered By - Always Learning
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing