How to get initiating jnlp file name/dir in java? - java

I need way to detect which jnlp file which started current app. in my case I'm developing an application that is started by jnlp file that contains some additional info. I need to delete this jnlp file while app is closing. app cannot be started in any other way. is it possible to get this information, and if it is, how can i do it. thx for answers

I need to delete this jnlp file while app is closing.
That choice is not available to the developer. It is a choice of the user, their JRE and system settings.
What application feature are you trying to implement from this?

Related

JAR program not allowed to open/save under MacOS Catalina ("the open file operation failed to connect to the open and save panel service")

I am having the following problem:
I am using Catalina (10.15.7) on a MacBook and recently I downloaded a JAR executable file (called JKnobMan) but apparently it doesn't have access to the open and save operations, even though the program runs normally otherwise, and it even lets me export. But naturally, what I want is to be able to save my progress and open it later on.
The message I get when I click 'open' is: "The open file operation failed to connect to the open and save panel service". I don't get this message when I 'save' but the saved file contains none of the information it should have (I checked this by opening the saved file on the web version of the KnobMan program).
I tried going to the Security & Privacy settings to give this program all necessary access but for some reason the JAR file is not selectable when I browse the items.
I expect this to be an easy fix, but so far I have been unable to find a solution. Some people experience a similar problem with email services and they're usually easily solved, so this must be straightforward as well?
Any help appreciated.
EDIT: Note that I'm not asking for help with THIS particular program. I assume that I would have the same issue with any other JAR executable trying to open/save in a Catalina environment. So, knowledge of said program is probably not necessary to know the solution.

How to avoid providing path in the code in Java swing

I have an Exe file created using Java Swing. I recently added a below code to open multiple session of an application at the same time. It works fine.
Runtime.getRuntime().exec("C:\Auto\format.exe")
The application is used by different users and hence they are forced to save the application on the same path. If not, they would be able to open multiple sessions.
How do I avoid using path here on this code or Is there a better option for me?
Thanks in Advance.
You could get rid of the path, when your *.exe file is in the same folder or subfolder of your Java program.
The only thing you need to care about is, that of your program is installed on somes computer, that you take the *.exe with you. You just could copy the files or you could create an installer (my suggestion).

Android java app installation under the hood

I am trying to understand what exactly is going on when you install an application (APK) on an Android device. I guess that files are are extracted from the package and copied somewhere on the device.
Are there other steps going on? For example, is the package name of the application written somewhere in the OS like in somekind of registry?
Is the application version number written as well somewhere or the OS reads the xml manifest of the application to know its installed version?
This is related to another question where I suspect that some data was not erased correctly during the uninstallation of a debug app and I am trying to find what that might be.
There will be files/dirs created in various locations, not necessary in all possible locations for every app though, it depends on how the app is configured.
This list is not necessarily complete.
Files/dirs:
/data/data
/data/app
/data/app-asec
/data/app-lib
/data/dalvik-cache
/data/local/tmp
/mnt/asec
/mnt/obb
/mnt/sdcard/Android/obb
/mnt/sdcard/Android/data
Your app will also get an entry in these files:
/data/system/packages.list
/data/system/packages.xml
/data/system/appops.xml

click a button on html which launches a runnable JAR application? possiblE?

Originally I had an applet that contained SQL server/jdbc stuff and wanted to use that applet in html but I guess it's not good to use SQL in html? because i kept getting millions of errors/exceptions and realized my applet would only work if i commented out my SQL code.
but anyways, is there a way that I can have a button on an html page that when it is clicked it will run the runnable JAR application not the applet? without causing errors..
I'm not sure what a JAva Web Start is or what a JNLP is but if anyone could explain/help? the Oracle Website doesnt explain well enough like how do i create a JNLP?
I currently have a runnable JAR file that was exported from eclipse that opens & runs when I click the icon
You are correct that Java Web Start is what you want to use. You have your JAR file built already, so you should be good to go by following this Deploying a Java Web Start Application tutorial
This will walk you through signing the JAR file, creating JNLP file. This web site contains an example of a JNLP file, and also contains more documentation on the structure of the JNLP file here
You'll then create a few simple lines of JavaScript, to be triggered when the user clicks a button. Something like this, as mentioned in the tutorial:
deployJava.createWebStartLaunchButton(URL_TO_JNLP, '1.7.0');

Finding the jnlp file that started a Java application (Java Web Start)

Background
I've made a Java application that is started by downloading a dynamically generated .jnlp file. What the application does is not really relevant, but its a screenrecorder. The user will download and start several (maybe hundreds) of these applications over time.
Problem
When the program ends I would like to delete the jnlp file that started the application. The point of the program is that nothing should be installed and nothing left behind. That includes the jnlp filed that one download to start it.
Question
Is there a way to find the jnlp file so i can delete it? (Preferably a File object)
Look up system property var jnlpx.origFilenameArg and delete it from the java application.
This worked on Java 6 update 26.

Categories