Skip to main content
gamedev.net
🔒 Locked

Fake .exe with Java using shortcuts?

Started by FinalMinuet Jan 19, 2005 at 8:15 PM 4 replies 1k views
Original Post
FinalMinuet
FinalMinuet
Ok, I wanted to see if it was possible to try something. I have a Java .class file. If I want to run that program, I have to open up the command prompt, change the directory to where the program is, and type "java someclass" just to get the program to run. I don't want to go through all that work to do that, especially since it takes a while to get to the directory. My idea was to create a shortcut to the command prompt, then in the properties part of the target line, type in the command prompt lines that would run the program, effectively creating a makeshift .exe file of sorts. Has anyone tried this? Or am I just doing things the hard way? If anyone has an idea how to accomplish this, I would very much appreciate the help.
tj963
tj963
It seems to me that would be easier to just create a shortcut to java.exe and pass it your class as a parameter. Then, if you set the working directory to be the directory where the class resides, java should be able to find it.

Or look into InstallAnywhere for a more complete solution, which I think is free.

tj963
tj963
Neil Kerkin
Neil Kerkin
I haven't done it in a while but you could just write a batch file that contains the line you type into the command prompt eg java c:\Program Files\...

save it, then you can run the app just by double-clicking the batch file
kaysik
kaysik
Both shortcuts and batch files will work, but did you know you can just drag your .class file onto java.exe and it'll run it? Infact you can even just drag your .class file onto a shortcut to java. If you make an icon for java on your desktop you can easily drag your class file and drop it on that (which is what I did). The benifit to this is that you don't need a different batch files for each class file you want to run (which is handy if your doing 3 java assigs at once).

However if you only ever want to run one java app its probably best just to use a shortcut to java.exe with the full path to your .class file on the end (outside the "") which you can then just double click on.
Dave Hunt
Dave Hunt
Instead of going through all of that, you could package your java program in a .jar file. Then you can double-click the .jar file and it will automatically run via java.exe.
caesar4
caesar4
ants
Cartman's definition of sexual harrasement:"When you are trying to have intercourse with a lady friend, and some other guy comes up and tickles your balls from behind"(watch South Park, it rocks)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.