Hi,

I'm considering writing a java applet that has a chess board and lets people solve puzzles. There are chess engines that are free that could be the AI to play against and they come in executable files (console apps) compiled for both Mac and Windows. Now i have a java stand alone chess board program that lets the user open engines and play against them they own on their computer using Runtime(); If i did an applet because i want it on a web page coudl i package one of these engines( its maybe 250 kilobytes) into the java bundle and when my applet loads it downloads the engine for me to open with the Runtime(); argument. I realize the applet would have to be signed. I guess the question has these parts. What is the file path to open an exe with runtime in the jar. Does this cuase anti virus software to not trust your app ( it would be signed), and is there a better way to do this, for example download the engine to maybe an applications folder on the computer and create a folder for my applet local on the computer. People using the program would have some trust in the web site as a source of chess content. I tried googling but any mix of java and applet and packaging an exe seems to return results related to thinks like packaging the JRE into the bundle or creating installers for java jars. Any help appreciated even if it doesn't answer all elements of the question.

thanks
Mike

for file path to open an exe with runtime in the jar. try

return new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
Member Avatar for iamthwee

No you do not bundle java apps as exes period.

Always jar files that way it will work on any os that has java installed.

The java part of the program would be a jar file. the exe binary file would be a dependency similar to how i might package image or sound files. the applet would only launch the jar. depending on what the user did if i needed to start the exe (think of the exe as a calculator and i need to give it inputs and get an output), i would use Runtime() from within the jar. Further the idea is sort of to load the right exe depending if its apple or windows. I'm leaning toward a simple server setup and let the server start any binaries and the jar simply talks to the server. The second part of my question stands mainly i would not want to do something that gets a web page blacl listed as insecure.

Yes, an exe can easily be bundled with your own code, but that does have it's implications on the server you can run it on. good luck trying to 'run' that exe on a Linux based server.

Member Avatar for iamthwee

Firstly, one you're using a deprecated technology.

Trust me, no-one uses java applets anymore on web pages. The idea was nice in principle, but the reality is it's old school. At some point I'd imagine flash to go this way as well. The recent move by youtube confirms my suspicions.

Two you're stuck, because you have to assume the user has java installed and your version. You really can NOT bundle this, best you can do is provide links to websites on ways to install.

1 for linux, 1 for windows, 1 for mac. As for wanting it on a webpage, the whole idea of downloading a chess engine and accessing that from the webpage is ludicrous because it contravenes the wholes idea of web apps being sandboxed, one reason I 'ate java applets.

So wrapping this up. Java isn't a good technology for what you intend to do. You don't download the chess engine onto the user's machine, rather you serve it from your server and the chess interface talks to it from your webpage, that way the whole thing is 'sandboxed.'

HTML and javascript would be a great option here, as it will work out of the box so to speak on any platform. Then you pick a server side language to play the engine.

I hope that clarified things.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.