Java: How do I get values from the other programs? [closed] - java

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 7 years ago.
Improve this question
To make the question more understandable, there is a software called CheatEngine, and basically what it does is, it collects all the bytes of the software that you're trying to work with and you can select any of those and change the value.
For example you want to change the score of any game. You can search for the value of the current score, and change it to what ever you would like.
Now the question is, is it possible to create something like that using java, that would take all the data from the memory, that the software you're trying to "hack" in to, uses?
Let me know which sources should I look up for.
P.S. If the post got grammar mistakes, I am sorry. I am from Russia and I am not the best in English language.

Java is very restricted in direct memory access (for a good reason), so it is very unlikely this can be done with Java. The JNI can perform (managed or unsafe) OS operations, so you could try calling any C function that returns the data at a given memory location, but I suppose you would be better off with using C in the first place (not Java), then.

By language definition java runs in a sandbox in the JVM. So it is impossible to access other places in the memory outside of it. Also Java cannot access specific positions in the memory, there are no pointers.

As I know you java doesn't provide support to access the memory directly. If you still wanna access the memory you have to use JNI. But then that is not a good option either.
So I think best way is to give up on Java for your purpose and try to use C or C++. C#.NET would be a possible too.
P.S
As #PhilipWhitehouse suggest may be there is a way with sun.misc.Unsafe package. Try to read on http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/

Related

Java: SQL and Statistics/Machine Learning [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 have a question for you concerning Java. I am basically a Java user and did most of my work with it. However, in the machine learning classes I took in college, we used mostly python with the scikit-learn and numpy packages.
Now I want to do a project where I crawl data from the web, store it in SQL databases, and then do machine learning on this data. Maybe some of you have experience with those things and share some of it? I mean, of course it is possible to do these things with java, but maybe you have had some particular experiences on why I should use something else or what to consider?
I am happy for all your thoughts :-)
Have a great weekend!
It turns out that programming language and database implementation are secondary problems. Think first about the machine learning you want to do. Review the existing packages (in any language) and pick one according to how well it fits the needs of the business problem you are trying to solve. Then work with whatever language is most convenient for that package. You will probably find that no single language is suitable for all parts of the problem; you will end up gluing together Java, Python, R, shell scripts, etc, to make a complete solution, and there's nothing wrong with that. Consider that your job is problem solving instead of programming in a specific language and go from there.

Making MATLAB Code Platform Independent [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a MATLAB code (including Simulink models) which I would like to make platform-independent, i.e., allowing them to run on web browsers and smartphone apps. Would coding it in Java be the best solution? And are there programs which can convert MATLAB code and Simulink models into another programming language easily so that I won't have to re-code everything out again? Thanks for your suggestions!
Short answer: You'll have to recode
Would coding it in Java be the best solution?
Probably not. I've found that java is hardly ever the best solution. It may be the easiest, but I doubt it's the best. But for web-browsers, AFAIK, you must render some part down to javascript (even if it's just a shim to fetch data running on a server), flash, silverlight*, or java*. For iphone, you need to do it in C, Objective-C, or C++. I think Android uses some kind of java-like/based language, but I don't know. I doubt Win Mobile 8 even has a JVM, but don't really know there.
* Few people like to leave these plugins open. Too easy to exploit and few sites use them.
And are there programs which can convert MATLAB code and Simulink models into another programming language easily so that I won't have to re-code everything out again?
Mathworks makes an m-code compiler, but you still need a lot of their libraries. It compiles for x86 under Windows and Linux. I think it supports a few other OS's, but all x86 unless they changed it around again. I guess you could try to get MCR working on a phone, but not in a web browser. Realtime Workshop renders simulink models to C, but not if they contain matlab function blocks (or some other blocks, I forget the full list). I hope you have a crap ton of cash, 'cause both those are expensive toolsets.

Why jvm is written in c++, any specific reason.? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I know that JVM is written in c++ but my primary question is java being good language probably better than c and c++, what is the necessity of writing it in c++. Any specific reason? just to want to know it might help others while facing interview at least. please dont debate as this forum doesnt support. Please give me solid reasons. thank you.
Java code needs the JVM to execute. However C++ is compiled into machine code, so it is executed more or less by the hardware.
Thus you can see that to write the JVM using java, would mean that you need a JVM to run the JVM... hence not possible..
This is the same with most if not all interpreted languages. They are written in C / C++. Typically C since that was more stable when the language was taking shape (e.g perl), and also because it is seen as being more light weight and faster (?) than C++.
When going from the design of a language X to the implementation, one thing is sure : you don't have access to language X tools because they don't exists yet. You need to use language Y.Now once you have language X running you can say you completely switch implementation from Y to X. But there is a cost : You are written a new software which should behave exactly like an old one. If the benefits outweighs the costs, then it can be a viable option.

Data storage management [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have a task to create a store system. The language that I use to program is Java and the information MUST to be saved in the pc where the program runs.
As far as I know Access does that perfectly when it comes to Visual Basic since I can use the Access interface and edit some cdoe with VB.
Another option I thought of is creating some kind of my own import/export system that will save the information into files and loads them when needed which will require a lot of extra coding.
So what should I do? What is the best way to do that with Java?
The standard way to do it would probably be to use an SQL database such as sqlite or mysql, but it depends a lot on what sort of system you're designing. Options are really,
SQL Database (such as sqlite)
NoSQL Database (such as couchdb)
Object serialization. You could just serialize objects and dump them to files.
Do you need to handle concurrency with multiple programs reading and writing to the database? Do you need low risk of data loss or corruption, or could you sacrifice some data safety for a quick and easy implementation? Do you need to store a lot of data or just some? How fast does it need to be accessed, and is it accessed all at once or do you need to query certain things?
We'd really need answers to all of those questions to be able to give you a good answer for what's best.

Is it possible to format a memory stick, pen drive or disk using 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 8 years ago.
Improve this question
I would like to create a multi-plattform utility to format / erase memory sticks, disks, etc.
Is it possible to do this in Java? Or do I need to call native methods for each operational system plattform?
It is very system specific, there is no universal way to perform this. Your options are
Create a JNI library to perform this using system calls
Write a wrapper class around utilities that perform this operation (for example, capture stdout and give inputs to stdin for an external process)
Use OS-specific techniques (as previously mentioned) to zero out devices
Use something like fat32-lib to manipulate specific file system types.
Not directly. You will need to invoke a operating system specific program to do the actual work for you.
On unix-like systems, you'd be able (only as root, most likely) to read the disk files /dev/{h,s}d* and write whatever byte sequence you want to them, including byte sequences that represent a, say, ext3 file system.
I don't know of any ext3 libraries in Java, though, so you might have to write it yourself. Or a library for the file format you care about.
This is probably not what you want, though, but you can settle for it :-)

Categories