Unable to read xml file when using exe4j to package jar into exe - jar

Recently I encountered a problem when using exe4j to package the jar into exe. My xml configuration file is placed in the same directory of the exe, but after the package is completed, the exe will look for the xml file from the temporary folder.
These are the instructions in the exe4j help documentation
For some applications (especially GUI applications) you might want to change >the working directory to a specific directory relative to the executable, for >example to read config files that are in a fixed location. To do so, please >select the Change working directory to: checkbox and enter a directory relative >to the executable in the adjacent text field. To change the current directory >to the same directory where the executable is located, please enter a single >dot.
The error when i running the exe :
[ERROR] In Log's init,cann't read config file, file=/C:/Users/**/AppData/Local/Temp/e4jEA8.tmp_dir1543543191//sys_log.xml
Why is the program not looking for this xml from the exe's sibling directory, and how can I find it from this directory?

If you are using the "JAR in EXE" mode, use
System.getPrpoerty("install4j.exeDir")
to get the parent directory of the executable.

Related

CLI method to find all nested jar files containing the log4j library

I have read here that the log4j library can be "nested" within other files that are deployed with an application.
I can find files with 'log4j' in the filename but don't know how to find log4j in these "nested jars". Is there a way to do this from the command line?
update
This question has moved to SuperUser here.
Run the following command search for log4j jar files in an application:
dir /s /b <application_root>\*log4j*.jar
If any files are displayed, check the version number that is part of the file name. For example Tomcat\webapps\ROOT\WEB-INF\lib\log4j-core-2.15.0.jar is version 2.15.
If the version is between 2 and 2.14 (2.15 is not vulnerable), the application is vulnerable to CVE-2021-44228 and one of the following mitigations must be applied.

jar -creation of log file in relative path using log4j

Log file is created if an absolute path is provided in the log4j.properties in a runnable jar created using eclipse. However, if relative file path is given , file is not created
log4j.appender.appLogger=org.apache.log4j.RollingFileAppender
log4j.appender.appLogger.File=.//logs//MyApp.log
Please correct this in your log4j.properties.
log4j.appender.appLogger.File=/logs/MyApp.log
For example:
In Ubuntu(Linux).
/home/bizruntime/Desktop/logs/MyApp.log
In Windows.
C:\\Desktop\logs\MyApp.log
If i have my log file in some folder of Desktop i need to specific the exact path.

jar file not found iexpress

I am using iexpress to make my .jar files into .exe files
for this I add the jar file(myjarfile.jar) and in run command box I type : java -jar myjarfile.jar
but after creating the .exe the cmd that is flashing says cannot find the jar file myjarfile.jar
can any body help me find what I am doing wrong
To test this, I built a simple HelloWorld.jar file (using these instructions) and tested it like so:
java -jar HelloWorld.jar
Then I made an IExpress package with it. The Install program was exactly the command I used above. This worked exactly as it should.
Two possible causes of the error:
In the IExpress wizard, there's a checkbox Store files using Long File Name inside Package. You should definitely select this option; ignore the warning that appears, as it applies to Windows 95/98. In the .sed file, this is:
UseLongFileName=1
Check that the .exe actually contains myjarfile.jar. 7-Zip will open the .exe and show you the archive contents. (IExpress .exe files are just a CAB file with a wrapper.) If the file is missing, then you'll need to check your .sed file to see what went wrong.

Can I run a jar file from shared folder of remote system just by double clicking from my system?

I shared a folder containing a .bat file which calls/run a jar file from same folder. I need to run that .bat file(present on remote system's shared folder) from my system. It run successfully if that folder is on my system but if i run the same file from shared folder of remote system it gives message "cannot access jar file."
Please help me.
Thanks in advance.

How to copy a license file which is placed with the setup.msi to target directory (setup created with msifactory)

I have created a Setup file i.e. setup.msi , this file contains a website installer
I have a License.xml file that I want to give to my client with the installer (setup.msi).
Before running the setup.msi , client has to make sure that the License.xml file should be in the same directory where setup.msi resist.
I want my setup.msi file to copy the License.xml file to the Destination directory (where website will be installed , this path will be prompted to user for customization)
I am using MSIFactory for creating setup.msi. I am not able to do this. I searched over net but did not get any accurate answer.
I am not familiar with MSIfactory, but in installshield what I would do is, call a batch script to do the copy and pass the target directory as a parameter to it. or use the 'XCopyFile' function to do the copying.

Resources