I am planning to develop a swing application tool ie. Expense calculator or software for personal use.
Is it possible to create such application so that I will talk with MS Access database to store data and once it is developed and i will be bundling it into jar or exe file.
So when copying the jar or exe file to some other laptop or system I dont want to configure the DSN name or connection setting to MS Access in each system where i am going to put the file.
instead on click of the exe or jar file the connection will be set automatically I mean the exe or jar should independently on each system where i am going to run it
( Is it feasible in Java )
Related
I have an application that uses a "signed" applet which is packaged inside a jar that does the following things:
Checks whether the file exists in the directory while uploading a file and opens a form for details.
An applet is included in JSP and checks the file exists in local system by getting storage path while uploading.
Checks whether the applet is active and downloads the file to local system.
Add files to application that will be stored as local copy in file system.
As the support for applets is getting removed, I would want to migrate from applets. I would like to know is Java Web Start the best option for replacing applets in terms of "security, trusted code" and signature. Are there any other technologies that comes useful for my application in the above areas?
Also found that
Migrate Java Applet to what/where?
Replace Applet in downloading and executing a file
Any suggestions on this?
I have a team of users that have read only access to a shared network drive. Sometimes these users will need to deploy their project resources to the drive. I am trying to come up with a secure build process for them to use. Currently I am using a batch file that they can execute from their local system which will do the following...
User starts batch file
Batch file calls a java program (the credentials are 'hidden' and 'encrypted' within the java program)
The java program handles the encryption process and then calls a final batch file that actually runs the NET USE command to map the drive with admin credentials
The final batch file maps the drive, copies the required resources onto the shared drive, and then re-maps the drive with original user credentials (read only).
My major problem is that users will have direct access to the batch files that do this entire process and they could simply remove the #ECHO off command from the final batch file to display all the credentials to the cmd output window.
I'm not sure if there's a better solution to this sort of thing? Any ideas will be greatly appreciated!
Also, all machines are using Windows 7 and using a Windows network drive.
The best solution would be to copy the resources directly in the Java program using the jCIFS library.
A second option would be to map the drive from within the Java program. There's more information in this SO question: How can I mount a windows drive in Java?
There are some .bat to .exe compliers out there. Not sure how well they will work for your particular batch file, but probably worth a look. You can search for them. Here's a couple of them out there
Advanced BAT to EXE Complier
Quick Batch File Compiler
Batch File Complier PE
I have developed an application with Netbeans (Using Java, JSP and JQuery) in Windows environment. Now I am ready to transfer the application to a web host so that the application can be available on the Web and I am told that the application would have to be moved to a linux environment (hosting service already bought). Here are my concerns:
How to convert my code to Linux? Is there an automatic tool for this?
How to deploy my application to the server online (what do I need to copy and to what directory on the web?)
My application writes to a directory on c:drive on my laptop, what should I do to make the application write to correct directory a designated directory on the web server?
I have read here and there online but just haven't got specific solutions to this.
How to convert my code to Linux? Is there an automatic tool for this?
One of the Java key features is portability, so as far as you haven't used any OS-specific code like running a program using CMD or similar or a library that is OS-dependant (which is rare in these times but there are some yet), then you don't have anything to do.
How to deploy my application to the server online (what do I need to copy and to what directory on the web?)
You need to generate a WAR file. This file will zip all your web pages (JSPs) and web resources (js, css, image files) along with the Java binaries (*.class) and libraries (that must be on WEB-INF/lib folder).
Since you're working with NetBeans, here's a Q/A to generate the war file: How can I create a war file of my project in NetBeans?
This war file must be placed in the deploy folder of your web application server. Usually, the hosting provides you the tools (generally a link on the web with user and password) to administrate the host, based on this you should ask (or find it by yourself) the option to upload the war file.
My application writes to a directory on c:drive on my laptop, what should I do to make the application write to correct directory a designated directory on the web server?
You need to configure this path as a constant in your application, or even better, configure it in a properties file (or somewhere else) in order to be read and use it by your application easily. Remember that the path should be generic to be supported in almost every OS. For example, if you use a path with name
C:\some\path\for\files
Its generic form will be:
/some/path/for/files
Since you're going to work on Linux, make sure the user who executes the Tomcat (or the web application server you will use on production) have enough permissions to write on that folder. This can be easily done (and somebody here can fix this please) using the chown command:
#> chown -R user /some/path/for/files
Here's another Q/A to manage files and path on Java web applications: How to provide relative path in File class to upload any file?
OK, first a few thoughts:
Convert code to Linux. Once you have your ear of war file, you can just deploy them. It's best if you use UTF8 enconding in your files, specially if you use special characters, but that would be an issue you could test out when you deploy, could also be dependant on the Linux configuration. Having that said, Java is portable and you only have to be sure that the archive you create is compatible with the AppServer that's installed on the Linux hosting. You should get all the information you need about the deployment environment from the hosting site / company.
Deployment will depend from site to site, they should give you all instructions.
Here you might have a problem. I would say that the easiest way is to just map the directory in a properties file and customize it on every machine you use it. That's the easy part so far. However, you should check if your site will give you access to a directory, and be aware of space limitations and cleanup of the files. If you get, let's say, 100MB and you use 10MB a day, you might end up with trouble after 10 days...
I made a simple java desktop application using embedded database. I wanted to package all files into a single file like exe so that client can click just on one file and use the application. I made the jar file and its working fine on my system when double clicking. I wanted to package the DB file along with jar because the data is shown only when the DB file is in the same folder of jar file.
I came across several tools like launch4j, install4j etc. but I didn't find where to include the DB file along with the package.
It sounds like you want an installer of some description, such as IzPack. This would allow you to package both jar and database together, and install them on a client system.
A good way to deploy rich client (e.g. Swing/AWT) apps. that require some set-up (as in, installing a DB) is by using Java Web Start.
JWS offers the ExtensionInstallerService which..
..is used by an extension installer to communicate with the JNLP Client. It provides the following type of functionality:
Access to prefered installation location, and other information about the JNLP Client
Manipulation of the JNLP Client's download screen
Methods for updating the JNLP Client with the installed code
Here is a demo. of the EIS (with code, build file etc.).
I have a great idea and I want to build a flex application around a .jar file. Is there a way I can go by embedding a jar file into the flex application?
There are ways to embed assets into a Flex application, however most people use this for images or other visual assets. I do not believe that jar is supported. Java and ActionScript are very different and you wouldn't be able to load a jar inside the flash player and execute it as a program or run commands against it.
If this is an AIR application, you may be able to do something using NativeProcess. But, such an approach is not the same as embedding a jar file in a Flex Application. It is taking your file and wrapping it up in an AIR installer and then communicating with that file as it runs natively on the machine.