🔒 Locked
[java] Desktop icons and java programs
Advertisement
Original Post
Well, I can only think of one solution at the moment.
You would have to make sure that the user has Java installed on his system. For Windows, there should be some entry in the registry describing the path to java.exe and javaw.exe. I can''t help you with getting this information out of the registry, but once you have it, just start up java.exe or javaw.exe with the path to your main class as argument.
I can''t help you with unix.
You would have to make sure that the user has Java installed on his system. For Windows, there should be some entry in the registry describing the path to java.exe and javaw.exe. I can''t help you with getting this information out of the registry, but once you have it, just start up java.exe or javaw.exe with the path to your main class as argument.
I can''t help you with unix.
Well then your shortcut would look something like this:
Target:
C:\Programs\Java\bin\java.exe c:\myJavaGame\mainclass
Path:
C:\myJavaGame
This should work... unless your game is packed in a .jar file. I'm not very familiar with executing right out of a jar file, but you could just unpack the whole thing with WinZip (jar files are actually only zip files with some extra information) and run it normally.
[edited by - FiveFootFreak on May 19, 2003 8:35:30 PM]
Target:
C:\Programs\Java\bin\java.exe c:\myJavaGame\mainclass
Path:
C:\myJavaGame
This should work... unless your game is packed in a .jar file. I'm not very familiar with executing right out of a jar file, but you could just unpack the whole thing with WinZip (jar files are actually only zip files with some extra information) and run it normally.
[edited by - FiveFootFreak on May 19, 2003 8:35:30 PM]
Sorry, you have to leave out the ".class" extension. I corrected the post above.
FiveFootFreak is correct. If you use javaw.exe instead of java.exe, you can run it without opening a console window.
If you use a jar file, you just have to edit the manifest.mf file and add an entry like:
Main-Class: package.name.Class.name
Do not put in the .class extention and put the fully qualified package name to your class, like java.lang.String.
First make it work,
then make it fast.
--Brian Kernighan
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
If you use a jar file, you just have to edit the manifest.mf file and add an entry like:
Main-Class: package.name.Class.name
Do not put in the .class extention and put the fully qualified package name to your class, like java.lang.String.
First make it work,
then make it fast.
--Brian Kernighan
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
Or you could create a bootstrap, i.e creating a native executable for all operating systems where you intend to run your program. I remember seeing something on javagaming.org on how to do this yourself in Windows. If you are using Borland JBuilder (or probably any other IDE) it can create one for you.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement