Burning source files onto a CD/DVD [closed] - java

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have created a game called "WordHunt" and I want to burn it to a cd/dvd..
Is there a proper way to burn java files especially GUI into the cd/dvd?? Is there a tutorial about it? can u please show it to me. I really want to learn it badly.

I'm assuming you have a game that you'd like to install a game you've written in Java from a CD/DVD. For that, you might want to use one of a series of freely available installer generators (found here).
If in fact you are simply trying to create a CD/DVD which autostarts a Java game, this explanation of Windows autostart procedures might help you:
[...]
If Windows finds a (plain text) file called AUTORUN.INF in the root directory of a CD then it follows the instructions in this file to run a program, as per the above descriptions. This example AUTORUN.INF file tells Windows to run program shellrun.exe (from the root directory of the CD) which in turn will show web page default.htm in the user's default browser. The other options are described below.
[autorun]
open=shellrun.exe default.htm
icon=shellrun.exe
action=Start ShellRun-CD
label=ShellRun-powered CD
Use the Windows Notepad application to edit plain text files (it is in the Start+All Programs+Accessories menu).
Your CD users may have switched off AutoRun. This might be because they are concerned about viruses. Also, if they press the Shift key down while inserting the CD, AutoRun is disabled.
There is no way to force your users to use AutoRun. It is therefore good practice to provide instructions so that users know how to start your CD, eg tell them to open file default.htm in their browser. These instructions are also required if your CD might be viewed by non-Windows users.
[...]
Having said that, the more "Java-like" solution to this problem would probably be something like a Java Web Start application. You might want to look into that technology before you go with physical distribution :)

Is there a proper way to burn java files especially GUI into the cd/dvd?
Don't do it!
The best way to distribute software to users these days is over the net. For deploying Java based desktop clients from a link, look to Java Web Start.
Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. It offers 'one click' installation for platforms that support Java.
JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..

Related

Load Linux library through a Windows client

several years I used to come on the bible of coding and I have (maybe) a question rarely asked. First of all thanks to all people which takes time to answer us.
I have a network with a Linux server and some Windows clients. On the server I have to use a Java application (I don't have source code) but it's hard to use it on the server : graphic card drivers are not update then the resolution of the screen is "small" and not expandable. It's a problem because layouts of the app are not dynamics then some important buttons are not displayed (is it so hard to use a JScrollPane ???). And I don't really want to learn how many times I have to use Tab for each hidden button.
Then one solution is to launch the app on a Windows client through MobaXterm. It works well but at one moment a process need a library.
I tried to launch the app by adding the library path of the library, a *.so file, but didn't work.
The question is : a java application installed on Linux and launched through a windows client need *.so or *.dll library ?
Thanks.
Florent

Can I use Java applications to control Windows 7 functions?

I'm relatively new to programming, I've been developing a lot lately in the eclipse environment and had the idea to build a small application for windows 7 that when I remove the power cord from my laptop it will enable my touch-pad and when the power is reconnected disable the touch-pad.
My question is how exactly do I go about building such an application?
Is there a package I can import that gives me access to the Windows 7 API?
And is it possible to compile a java application so I can have it run at startup?
I agree with Andrew that java is probably not the best choice for such kind of application but anyway here is what you can do.
Java 7 file API is able to listen to file system. You should listen for the changes is root folder of your card. I guess you will get exception when card is disconnected.
Touch pad may be invoked as an external application. Take a look on this discussion for details: Java - invoke on-screen keyboard
Alternatively you can use JNI, JNA or one of java-to-windows libraries (JaWin, Jintegra, Jinterop). But I think this is much more complicated. I'd recommend you to start from the first solution.

Installing java program via CD

I have a program (java jar file) that I want to distribute on CDs. My friend told me that there are free/open-source CD installers available that automatically install your program onto the customer's computer.
Now I can't seem to find this on Google. So are there any CD installers that you would recommend that I can use (so I don't need to program one myself).
Outline:
My program consists of class files, sound files, source files (i'm open source) and images (packaged into a jar file).
I only need the installer to work for Windows computers.
I think IzPack does something like that.
You can look into Java WebStart which in Java 6 was enhanced to allow "launch-from-cd-and-install-to-harddrive" which mean that it can work as a very simple installer.
It requires a JVM already present. You can put the redistributable JRE on the cd too.
Launch4J is what I have used as my installer. It is really lightweight and has a nice GUI that makes things simple for the developer (one reason I chose not to use IzPack).
It makes things dead simple for both the developer and the user.
Your jar file is wrapped in a exe launcher.
If an up to date JRE is not detected, a bundled JRE is used or the user is prompted to download via java.com/download
Really, I couldn't have asked for anything simpler/better. Although you might get more functionality out of IzPack, if you want something dirt quick that can do everything the everyday developer needs, go for Launch4J.
P.S. Their splash screen option is a nice bonus :)
After running into numerous end problems, I finished the job with the use of Inno Setup.
Very quick and easy to use. Creates an installer similar to the ones you would see in popular programs. Gives you (and the user) the ability to create Desktop Shortcuts, QuickLaunch Icons and Startup folders. Allows you to add license information etc. Very simple and intuitive interface, I didn't have to read any documentation!
A big con: Only makes installers for windows. That met my requirements, but may not work for everyone.

Design of auto-updating software [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
Simply put, how would you design an application that supports straightforward and reliable auto-updating?
I'm interested in how it could be cut up and the various operations involved.
Edit: This is linked to this question: Self-destructing application
Concerns that need to be dealt with:
If the app that does the updating is itself being updated, a restart is going to need to occur, or a stub would need to be executed to move the file into place (to avoid a file-in-use error.)
Whatever service you're communicating with to retrieve files via a web request would need to know what current version of installed package you're running. It would dynamically build the file URL list and maybe even zip up a file and put it out at a single URL for the client. Otherwise, have the client walk through the URL list, pulling each file. Each URL would be associated with an operation, such as 'copy' or 'execute'.
Process each retrieved file and install it to the client.
Update needs to be atomic (ability to rollback if any part of the operation fails.) You don't want to be left in a partial state.
Java Network Launch Protocol does a great job of making it easy to deploy auto-updating software. Some people on this site have reported issues with it, but that may be due to using older versions of Java or not correctly setting up the JNLP file. I have found that it works great on Mac and Windows and on a PC at work without logging in as an administrator, I was able to effectively "install" my software. From the user's persepctive, it is just like I gave her a new desktop app. There is a program icon on the desktop and files saved by my program are associated with it - windows gives them the right icon and when you double-click them they open. But every time she runs the program, JNLP first checks her locally stored JAR files against what is on my server and if her files are older than the ones on my server, the software gets updated. The programs still launches as fast as a native windows app, except for the first time when it has to download everything.
Now to make the program self-destruct, here are two options:
Change you jar files on the server to be short and useless. The user launches the program, it updates, and then they see a dialog box telling them that the program is no longer available. You can also disable features this way. But this will affect ALL the users at once. You could create several different JNLP files, each for a different class of users with the same time line for your app to live, you could even have a service generate the JNLP file. But the control to disable it will still come from you changing the jars on your server.
When the program starts it first contacts a web service to verify that the program should still be running. You can create a database table associating your users with which features they can use now. If your users do not register, you would need to somehow create an id for them when they first run the program, place it on the db table and store it on the client's computer using the preferences api.
If you are unfamiliar with using JNLP to autonate updates, here is some background to help you get started:
A JNLP file is an XML file that describes where your application is stored on-line and which JAR files it needs to run. Various properties of the app are also specified, like a splash screen, desktop icon, the updating style (always ask, just upate without prompting, update in the background) and which files to associate with the program.
Read the JNLP developer guide for detailed insturctions on how to get it working.
You can also see numerous examples on-line. In Chrome the default behavior of a JNLP file is to just save it, in other browsers you may need to right-click and save as, but that only works if there is a direct link to the file and not a fancy javascript button. You can then open the JNLP file in your favorite text editor as an exmaple.
The swing tutorials use JNLP files to demonstrate the code.

Demo Java application runnable from a DVD

I wish to give some demo copies of a Java application on a DVD to a client. Does it make sense to have a preinstalled JRE and Java application on a DVD so that they can just click and run it?
Also, if anyone has done this what are your views on this?
I would suggest you skip the DVD and go for a flash drive instead. This way you can use portable Java and run your app from the flash drive without having to install anything on your client's computer. With the low costs of flash drives these days you should easily earn back what you spend in money in convenience and time.
Here is a tutorial that shows you how to set this up.
Indeed you can simply put a JRE into a directory of the DVD.
Then you start the application with a .bat file that runs a command such as :
jre\bin\java.exe -jar Main.jar
(If your jar and the jre folder are in the same directory)
Be careful about one thing : you can't know in advance what the DVD's drive letter will be, so in your .bat file you must give relative paths to the JRE and to your jar (or starting class).
If you are dealing with a one or two people then just throw a JRE on the DVD and explain how to install it or even just include a link to the page where they can install Java themselves. In the past when dealing with a large set of recipients that needed to install a JRE and run an application, I have used tools like InstallAnywhere, to create a simple setup to walk the user through a wizard for setup.
I've in the past copied a windows JRE directory to a USB flash drive, and run a java app off that.
If:
The users have an internet connection
The demos. have a GUI
You can deliver them off a site
..I would recommend using deployJava.js to ensure a suitable minimum JRE, & Java Web Start to download/install & launch the demos.
JWS has a number of advantages in this situation:
Server hits for the resources will reveal what proportion of the people to whom the demo. was delivered, are actually trying it.
JWS offers 'lazy downloads' so that if a potential user is only interested in one small section of a large application, they do not have to download the entire binary.
If the user turns a demo. into a registered version, (at least parts of) the app. will be already installed.
But in the event that it is a constantly changing app., JWS will automatically update any new parts of the app.
All this is part of the 'one click' installation experience for JWS. It is more tricky for a developer to set up, but once done well, is a breeze for the end-user.
You might include an HTML page on the CD (DVD would be a waste for a single HTML, a couple of images & some CSS based style sheets) that links to the demos. But since the hardest thing about getting a user to try a demo. is getting them to put the disk in the drive, I would side-step the disk entirely & send the 'Here are some free demos.' HTML to the user as email.
This was included as a comment a couple of days ago. Since the thread was resurrected, I decided to include it as an answer & expand on it.

Categories

Resources