Well, as I was thinking on my way home, it's not as simple as that. You have to place yourself first in the root directory of the compiled classes' tree.
But if you use Netbeans, there's an easier way. After you build (F11) your project using Netbeans, it creates an executable JAR file in the 'dist' directory of your Netbeans project directory. The JAR file should open with javaw on double-click, so I think all you need is a shortcut for that JAR (or the JAR itself, if it used no other JAR libraries). But I think that you won't see nothing if it's text-based. You can try to "Open with..." the JAR with java.exe instead, and there you go. Yet, if you're expecting some final result in the screen, you won't see it in time, as the window closes right after the java program ends. You can workaround this one by creating a simple batch script (kind like shell script if you're a unix guy). I'll assume that: Your JDK is installed in: C:\Program Files\Java\jdk1.6.0_14\bin Your Netbeans project folder is: C:\Users\VBrun\Documents\NetBeansProjects Your project is named: MyMathGame You have built your broject through netbeans. To create a batch script, edit a new file and call it "myprogram.bat", with: cd "C:\Program Files\JDK\bin\java.exe" -jar C:\Users\VBrun\Documents\NetBeansProjects\MyMathGame\dist\MyMathGame.jar" pause Where the "pause" command simply waits for a final key stroke before closing the window. Any other suggestions for this? I'm curious myself if there is a better way to create a simple shortcut to a java application. Hugs Diogo Oliveira wrote: > All of the sudden, I can think of this way: for each program, you can > create a shortcut for java.exe (located in your jdk's bin directory) > and edit the shortcut properties, specifically the Target property, to > run a specific Java class. I think you just have to add the full path > of the class in the field. > > I'm not sure it will work, I never tried it. Also never used netbeans, > so maybe there's some way for the IDE to generate a JAR file so you > can run it right out of the box. > > But i'll try this as soon as I get home and I'll come back to ya! > > Greets > > On Mon, Jul 13, 2009 at 3:25 PM, victor bruno <[email protected] > <mailto:[email protected]>> wrote: > > Hi fellows! Hope you all are doing well and keeping busy > programming with passion. > I have just created maths solving programs and games as well. > Given that I use them often I wish them to be on my desktop icons > so that I don't have to start the IDE whenever I want to use them. > How to do that? > > Thanks!!! > > ------------------------------------------------------------------------ > O Windows Live Spaces já chegou! É fácil criar o seu próprio Web > site pessoal. Veja só! <http://spaces.live.com/signup.aspx> > > > > > > -- > Diogo Sales Oliveira --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
