How do you get a handle on a running application's context? [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
There are ways to get the details of the run time "-XX:" parameters passed to the JVM as some java code is compiled and executed and, of course, you also get the System.{getenv(), getProperties(), ...} and input parameters passed into the running instance from your code, but what kind of strategies or applications are being used to customize a running instance?
As part of my unit tests at times I need to marshall some data before passing it into my application and/or set up many different input parameters. I went monkey and included some name-protocolled files in "user.dir", "user.home" and one step below "java.home" as well as "user.name", the start time of the running application, ... to setup the name of my log files, decide if I wanted to redirect log System.{out or err} to files or having them dump the values on the screen ... instead to having to do this programmatically. I found a question asked 13 years and 8 months ago about these kinds of things:
Current directory in java properties file
I think in java you could use the reflection API to strategize a solution to those kinds of problems. Do you know of any application taking care of such issues or strategies used to deal with them?

Related

How do I capture information from a table in a Java program? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I'm trying to capture data from a table without using an RPA. I'm studying interceptor system APIs, but I can't get much reference on how to do this.
The main problem is that I need to get a table quickly, without the need for scrolling. The possibility I thought of is to perform the capture in the operating system's render, since the table would already be loaded.
Does anyone have any idea how to do this and if possible send content for study and reference?
thank you and sorry for the bad english
I've already tried to use an interceptor that renders a part of the application's jar so that I can get the data, but I failed due to the JNI not being able to find the class. I hope to be able, somehow, to get this information quickly and without the need to read it on screen.
More details:
The software is a desktop application developed in Java using spring;
the application displays on the screen a table containing 5 columns and several lines, approximately 2000 lines, which is not fully displayed on the screen, thus containing a scroll bar;
I'm considering using an API hook to try to intercept the data that is sent to this table at the time it is built/rendered at the time the software is loaded. That way, I don't spend time reading the screen and scrolling to get all the lines.
To solve this issue, I'm using Java to access the JVM and testing some things, like JavaAgent and Javassist, but I'm not sure if that would be the best way or if there are other ways to explore.
It is also worth mentioning that I have the application's Jars and can decompile them.

Create a string when running an application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I wrote a Java program and I want to make payments on it. (For Android)
Now for the payment, you need to have a RSA key provided by the relevant market, which is, in fact, to identify our program from other programs and should be kept away from the hackers so that the program does not crack.
And while Android apps are simply a few clicks away, you can see this important thread.
I read somewhere that, in order to keep the threads hidden from the point of view of the hackers, we need to build them in during the execution of the program.
How to create a string during the execution of the program, even after the program source and all its methods and classes can be seen, it is still impossible to find the desired field by implementing those methods and classes ?
Please tell the offline method without using the server.
Android OS provides something called Android keystore which is meant for storing critical data like passwords and in your case encryption keys. It is secure enough to protect data even in rooted android devices. refer to this tutorial

Create your own update system in Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I would like to implement a Java application that can download a new version (.jar file) from a given URL, and then update itself at runtime.
We retrieve the versions available on the internet
We compare them with the current version
If the current version is newer, a message is displayed telling the user that there is no update possible
Otherwise, the user is informed of the possible versions and given the choice when to download.
If he wants to download one, download the one he chooses
Then we restart the program
The program at startup must see if there is a new version, and if necessary, take it ==> use a launcher
What is the best way to do this and is it possible?
Take a look at Getdown. This solution precisely addresses your problem. The docs say:
(GetDown) is a system for deploying Java applications to end-user computers, as well as keeping those applications up to date.
Don't bother with Java Webstart as since java 11 it will no longer be available.

Let user change configuration parameter [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
In Java web application, I have some configuration parameters that I keep in config file. For example frequency of calling a particular method.
I want to let user change this using a UI. So, how and where such parameters should be defined so that user can change them and changed value comes in effect without need to redeployment.
Further explanation:
Lets say I have a java servlet that takes the back up of few files. I have scheduled this to run daily at noon. Now I want to let user change the time at which he wants to run backup using a interface (web page) that allows to specify new time.
So, how really should I declare this time in application. In a config file ? As a environment variable or something else so that the new changed value comes into effect without deploying the application.
Hope this explains things better.
SOLUTION:
Just to share with everyone... found this post which answers most of my concerns.
LINK
I would suggest you to modify your implementation to achieve this efficiently. Store the parameter for scheduler in your database. Once the user selects from UI, insert into the database.
Now, instead of config file, make your scheduler read from that column in db. No deployment required.

How to dynamically generate code for object oriented tool? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am kind of stuck in a dilemma. I want to create a tool that would generate code on the fly by taking various parameters from the user. The codes have a few similar features and few things need to be altered from one code to other to other. Based on the parameters, I can have 15 different codes. Till now I have been using file handling in Java to implement this as I have the created codes in different files but this doesn't seem to be a great method. Can you please suggest something that is better than this??
Since Java 1.6 you can compile in memory whatever you want. Take a look at this code:
http://code.google.com/p/cachos/source/browse/trunk/cachos/src/com/peyrona/cachos/InMemoryCompiler.java
http://code.google.com/p/cachos/source/browse/trunk/cachos/src/com/peyrona/cachos/InMemoryExecutor.java
In this example you can see how you can compile a source code stored in a String in memory, without using the disk.
Source (Spanish): http://www.javahispano.org/portada/2011/12/12/compilar-y-ejecutar-codigo-java-en-memoria.html
I think this is what you're looking for.

Categories