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
The target computers have either MySQL or SQL Server running on.
We get JDBC drivers for MySQL and SQL Server in our project.
When the users start the application they select which of the 2 databases to use.
One thread handles the GUI CRUD buttons and another handles the CRUD logic.
We get everything into .jar file(including the JDBC drivers) and convert it to .exe to be executed on the target computers.
Is this plan correct or it doesn't work this way?
Just include both the drivers, that's totally ok. As long as you only load one there definitely won't be any problems.
You may implement a simple detection of the databases at their standard paths / check if it is already running on the default port. If there's only one database avaiable, just work with that.
If you use Swing, there's the SwingWorker class to encapsulate (long running) CRUD operations. The gui is managed by the main thread / EDT, there's no need to exactly create 2 threads, if you're doing it right. (Although internally there will be multiple threads, but I'm talking about explicit Thread creation here.) Otherwise you would produce them busy wait scenario which could be really cpu consuming.
You can produce runnable jar files, which can be double clicked and executed on most systems, there's no need to convert it to exe-files.
Related
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 2 years ago.
Improve this question
I want to build an E learning app using Java. The GUI will be made using JavaFX and for database I will use MySQL. So far application runs fine on localhost. But I want the application to be multi user. I m a little confused because I ve read different options like client/server and RMI. What would be the best approach in this case? For example, if the database is on another computer, and several clients will run the app (the app will contain both GUI part and database operations part via JDBC) is it ok? Or do I need to separate client part (like GUI) from actual database operations (Server part)? What about RMI? Does it make sense to use RMI in this case?
In the database the app will store user credentials and user progress. I will grateful if someone could help me clarify this
I would NOT recommend exposing the DB to the Internet.
I would recommand implementing an REST-API for the Communication between DB and Client (JavaFX GUI). The big advantage is that you can control which operations can be executed against the DB and which not. I dont now about RIM btw.
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
In an enterprise back-end Java application, I have a requirement where some part of code calls various API which are independent of each other. On receiving response, I am utilizing them and passing data to requester.
For this, I have implemented callable based multi-threading (using Executor). But a colleague is stating that implementing multi-threading would make my code responsible for managing resources and not the Web App Container which can lead to performance issues.
So I wanted to know, what is the impact of implementing multi-threading in my code? And how can I make sure that resources are managed properly without impacting overall application.
There are a some different aspectes mixed together in your question. Creating threads on an application server is not prohibited because it could cause performnce issues. It's more that the server itself is responsible to manage the system resources. Spawning own threads, of which the server is unaware of, can not be managed by the server. See this page for more info about the topic.
Using an thread-executor that is provided by the platform, is very valid an could be used to implement multi-threading nevertheless. See here for example.
Another aspect of multi-threading is indeed performance. Creating threads comes with a certain cost and creating too many of them may lead to an overhead in conext-switching. The trade-off between pralellism and having to manage a lot of threads has to be consireded by the developer. Again this is why application servers, manage their own thread-pools.
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 4 years ago.
Improve this question
EDIT: rewording my question to make it less vague: Would running a java app through a jar file on a node child process be slower than building the gui on Java? To clarify, I'm not asking if node is faster than Java, but if executing a jar through a child process is noticeably worse than running it natively in its own environment.
I have an app, kind of like a calculator that allows bit manipulation and persists data, and I would like to run it through node. The reason for this is because I want to release this as a desktop app and am familiar with React and Electron so I wanted to build the gui with those tools. What is the best way to do this? I have found many approaches but they all seem to be ideal for different situations. My app will not need to communicate to a server to run any code, all of the logic and data manipulation is on the java app, I just want to run it through node so I can create an interface. Here are some of the options I have found:
Create a .jar file and run it through a child process.
Use socket communication and talk on a Port (this looks like its used mostly for server communication but can be used on the same machine so i think it would still solve my problem)
I have also considered re writing the code in node (its not a lot of code so wouldn't take too much time) and also using JavaFx to create the gui, but I only want to resort to these options if they're significantly better that trying to run java code through a node app.
as per this answer:
Execute java code on a server
using a .jar is good and can be run through node directly.
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 6 years ago.
Improve this question
I am beginning to write a basic "study-buddy" program as a side project. One important feature I want to implement is that the program can access the state of other programs running to prevent you from accessing them / yell at you. For instance, if you had Chrome open to Facebook, or if you launched a video game.
First off, is this even possible/reasonable to accomplish in Java? Second, specifically with Chrome, how can I access the programs state from another program that I am writing? More generally, how can I access ALL programs running on the computer and check to see whether anything violates "study-permissible" programs?
I would put this as a comment, but my reputation point is not enough.
One way is using the commands the operating system provides. You can run a command with
Runtime.getRuntime().exec("<command name>");
This will give you the related process and you can get the output of that process just as manually running the process. Then, you can utilize the output.
Basically if the OS provides you that information manually, you should be able to get the information within 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 9 years ago.
Improve this question
I created a table in an Oracle database on my personal computer.
Then linked it with a Java Application and I am using that table/database to save all the data from the application.
But when I deploy my .jar file and run it from another system, that database is not installed on it.
Can anyone please tell me or guide me what I am suppose to do? In order for the database and the application to work on other systems too.
Thanks
Basically, you'd need some options in your program to allow the user to configure which database server they want to use.
It would be up to them to deploy a server and provision it correctly before they could use your program. Instructions on doing so would be included in the setup documentation for your program.
It's also possible for your program to be able to setup a database on a remote Oracle instance automatically. You would implement an option to allow them to CREATE DATABASE on a configured Oracle instance, which would run provisioning scripts to create all the necessary tables, views, sprocs, etc.
Since these steps create a lot of friction in deploying and using your program, you should also ask yourself if you really need a SQL database for your program. If it's just single user with a small amount of data, you could check into some sort of local DB that runs in proc.