Results 1 to 13 of 13
- 07-23-2013, 07:02 AM #1
How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
Quick question (hopefully). I've finished a program. It's done and freshened up and had its finishing touches and is ready to launch. However, I don't want to have to open Dr Java, or Eclipse to run it. I'd like the program to run without users being able to see the code (like a normal program), through a desktop shortcut or launcher. How would I be able to do this? Hopefully this is enough information for this question to be answered.
- 07-23-2013, 07:18 AM #2
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
Create an executable jar. Many (most?) systems with Java installed will then be able to run it by double clicking it. You could also include a shell script or batch file to start if double clicking fails. And if you're using Maven, there's a plugin to build an OSX app bundle... though I've never had much luck with it, and ended up coding Apple Java Extensions integration by hand.
Get in the habit of using standard Java naming conventions!
- 07-23-2013, 08:44 PM #3
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
So if I were to create an executable jar, how would I go about doing that..?
- 07-23-2013, 08:47 PM #4
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
I would suspect that most IDE's support that. I know Eclipse does. However, if you must do it manually then read about jar files in the tutorials in my signature. Go to the Really Big Index and scroll down until you hit the section on Jar files.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
- 07-23-2013, 09:00 PM #5
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
I never knew Eclipse had a function like that. I think that would be my main alternative before I try anything else. I guess it'd be too much to ask how it's done in Eclipse, so I'll look up how to do it in Eclipse first before I ask any more questions, thanks (I'll still use your sig for future references, much apprciated!).
- 07-23-2013, 09:22 PM #6
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
I find the Eclipse way a bit obscure myself, Netbeans builds one without asking as part of its project build cycle.
I use Maven myself to automate such things inside and outside of Eclipse, but that may be a step too far at this point in your learning process."Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 07-23-2013, 09:29 PM #7
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
Under File, go to export...
Then choose runnable Jar file. This does work but it has limited functionality. And interrogating regular jar files and manipulating them under Eclipse is almost non-existent. One of these days I may write a plugin.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
- 07-23-2013, 09:50 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
Build a wall around Donald Trump; I'll pay for it.
- 07-23-2013, 10:00 PM #9
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
Yes, I've figured it out with the Runnable Jar method. Many thanks. My final question on the issue, if it can answered; Is there a way to make the file type an Application, rather than a JAR? When I right-click the file to see details, it says Type of File: Executable Jar File (.jar), while other normal applications say Application (.exe). Is there any way to make it an .exe rather than a .jar, or is that yet another limit of Java? Can I also change the icon image? The coffee cup thing seems rather bland.
- 07-23-2013, 10:29 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
I don't know those MS Windows specific things, sorry about that. I don't think it's a limitation of Java though; a .jar file isn't a binary executable file.
kind regards,
JosBuild a wall around Donald Trump; I'll pay for it.
- 07-23-2013, 10:34 PM #11
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
I know there are programs available to do that. I don't know the specifics but the target system will still need a JRE to run the app. I believe this topic was discussed in this forum. Try searching the posts using .exe as the keyword.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
- 07-23-2013, 11:00 PM #12
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
They are called 'jar wrappers'; I don't think I've ever seen a single one that can generate an executable for all popular platforms. And yes you still need a proper runtime, the executable that you can generate using these tools is basically a more specific version of Java.exe - it binds to a pre-installed Java runtime and starts up the virtual machine. Some of them are clever enough that they can detect Java is not installed and can route the user to java.com.
But executable jars are not a limit - they are a feature. An .exe does not work on Linux or Mac, but the executable jar does."Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 07-23-2013, 11:49 PM #13
Re: How to Start Program with Desktop Launcher Rather than Through Java (Eclipse)?
I see. I'll be sure to do that. Regardless, thanks for all the help, you guys have been really informative.
Is that so? I guess I was out of place to call it a limit. Perhaps it's just my own inexperience. When running the Jar File, things like pictures and .txt/.dat files can't be located, and are returned as 'null'...
edit: Nevermind after the 'null' thing. Just another blonde moment, hehe.Last edited by CuppaCoffee; 07-23-2013 at 11:53 PM.
Similar Threads
-
Start Swing GUI program by Java Web Start with IE in Eclipse debug mode
By albertkao in forum EclipseReplies: 1Last Post: 01-18-2011, 07:27 PM -
Java(TM) Web Start Launcher doesn't work after a software update for some users
By Richard Gillespie in forum Advanced JavaReplies: 0Last Post: 12-21-2010, 04:21 PM -
How do I run a java program that I made off of my desktop?
By Chris Rice in forum New To JavaReplies: 2Last Post: 06-30-2010, 08:19 AM -
How do you start a Java program from the "Start" menu under Windows?
By ScottVal in forum New To JavaReplies: 5Last Post: 03-20-2009, 11:04 PM -
writing a program launcher (or Timer)
By Farzaneh in forum Threads and SynchronizationReplies: 3Last Post: 02-17-2009, 10:00 AM
Bookmarks