开发者

Java app in a Flash memory

开发者 https://www.devze.com 2022-12-16 10:03 出处:网络
Someone ask me to de开发者_高级运维velop for him an Employee Leaves Application and he can carry it in his flash memory so that he can enter data at home, office or his private company.

Someone ask me to de开发者_高级运维velop for him an Employee Leaves Application and he can carry it in his flash memory so that he can enter data at home, office or his private company. I've chosen Java and SQLite cos they are free. Can I create a Java standalone application that it can run in Flash memory when he plug it to a Windows XP platform ? Thanks.


Yes. While the Java Runtime does write things into the registry such as "default JRE" .. you can still include a copy on the flash drive and call the java.exe command directly from the bin folder.

Here's an example setup. Let's say the flash drive is mapped to F:\. Your application is located at F:\YourApp.jar

You copy a Java install from Program Files and paste it to F:\Java

You then write a quick batch script to launch your program using the local java command. The batch file would look something like this:

@echo off
Java\bin\javaw.exe -cp .;YourApp.jar YourMainClass

You could name that start.bat or something similar, which should be obvious enough to your client.


I believe you can.

I think it means that you'd have to have the JRE on the flash drive as well, because you can't depend on it being available on every PC that the app needs to run on. The version has to be correct for the OS that the flash drive connects to as well.

Just check the license wording for SQLite.

It sounds pretty insecure to me.


System where he runs this should have compatible Java Runtime Environment (JRE).

Code that you develop must not have reference to system resources like D:\my_directory\my_file.txt

Code and Data should be should both be stored on flash drive else you will need program to synchronize/merge data.

You need backup so in case something happens to flash drive you can still recover your data.

Your program and data on flash drive must be encrypted and made secure.


I would suggest you look into how to launch programs from a CDROM with Java Web Start as this appears to be very similar to what you want to do.

This allows you full control over the launch process in a standard way, but requires you to create a well-behaved JNLP application.

(Note, you need Java 6 installed on each PC for this to work, but then your life will be quite easy on)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号