Running Java Program outside an IDE

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2005
Posts: 86
Reputation: vicky_dev is an unknown quantity at this point 
Solved Threads: 2
vicky_dev's Avatar
vicky_dev vicky_dev is offline Offline
Junior Poster in Training

Re: Running Java Program outside an IDE

 
0
  #11
Oct 4th, 2007
Originally Posted by masijade View Post

Edit Again: All of these, BTW again, would also be non-issues, if you had learned Java the right way, rather than learning it using an IDE (which is really only learning to use the IDE and not learning Java, as illustrated by these questions).
Yes, I know all about javac and java and compiling and executing Java programs... Thats really the first thing I learnt. But I wouldn't expect the end users of my application to go to the command prompt to execute it... They should be able to do that just like ordinary programs. See one of my earlier posts to see what I mean.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 164
Reputation: orko is an unknown quantity at this point 
Solved Threads: 10
orko orko is offline Offline
Junior Poster

Re: Running Java Program outside an IDE

 
0
  #12
Oct 4th, 2007
oh... now i understand... :-S... so hopefully u r not giving ur java files away... u can write a batch file for ur windows users and a shell script for ur unix users... they can execute both by just double clicking... it shud solve ur problem...
A Perfect World
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,432
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 258
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: Running Java Program outside an IDE

 
0
  #13
Oct 4th, 2007
Originally Posted by vicky_dev View Post
Yes, I know all about javac and java and compiling and executing Java programs... Thats really the first thing I learnt. But I wouldn't expect the end users of my application to go to the command prompt to execute it... They should be able to do that just like ordinary programs. See one of my earlier posts to see what I mean.
If they install Java properly, and you provide them with a jarfile all they need to do is double click on it. No muss, no fuss. The only problem is third party libraries, but that's why they make installers, and there are all sorts of free ones to choose from.

Edit: Then again, if you use an installer, you can have it install Java as well, so that is also a problem solved.
Last edited by masijade; Oct 4th, 2007 at 2:50 pm.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 101
Reputation: cms271828 is an unknown quantity at this point 
Solved Threads: 4
cms271828 cms271828 is offline Offline
Junior Poster

Re: Running Java Program outside an IDE

 
0
  #14
Oct 4th, 2007
If you use an IDE like eclipse, you can JAR it there, by right clicking on project, then 'Export'

If you want to convert into an exe file, its probably easiest to use a tool like...
http://mpowers.net/executor/

The trial version of this always opens a command prompt, and doesn't let you change the icon, but the proper version does not show command prompt when you run, lets you change icon, and lets you package a JVM into it incase the OS the exe is about to run on doesnt have java installed.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 27
Reputation: schoolsoluction is an unknown quantity at this point 
Solved Threads: 3
schoolsoluction schoolsoluction is offline Offline
Light Poster

Re: Running Java Program outside an IDE

 
0
  #15
Oct 5th, 2007
If you want to distribute the JAR file in a 'nice' way (splash screen, easy installation, creation of shortcuts with your own icon) you can distribute it through 'java web start'.

That gives you the possibility to distribute the installation through the web. And you can update your program very easily on all stations by putting new versions of your jarfiles on the webserver.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 86
Reputation: vicky_dev is an unknown quantity at this point 
Solved Threads: 2
vicky_dev's Avatar
vicky_dev vicky_dev is offline Offline
Junior Poster in Training

Re: Running Java Program outside an IDE

 
0
  #16
Oct 5th, 2007
Thanks everyone, I now know many ways to distribute my Java apps... jar files, batch files, web start or exes'. You guys are really helpful...

One more question... Is there a standard registry entry in Windows that tells me the path of Java.exe? Just so that I can tell whether Java is installed on a particular machine.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,432
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 258
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: Running Java Program outside an IDE

 
0
  #17
Oct 6th, 2007
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\Current Version

Will give you the current version and

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\<current version>\JavaHome

Will give you the jre directory. Check up one level from that for a bin/javac to determine if it is a jdk. If that does not exist, then it is only a jre.

Edit: This is, of course, Windows only, which makes it paltform depedent. To try, first for platform independence, try searching for a jre or java on the path from a System.getEnv("PATH") call, but it is, obviously, not guaranteed to be found there. Otherwise, you can use the rpm command to find it on Linux, and pkginfo on Solaris. Other OSes, I couldn't tell you. None of these, however, are truely satisfactory.
Last edited by masijade; Oct 6th, 2007 at 5:35 am. Reason: typo "Java Home" instead of "JavaHome"
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 86
Reputation: vicky_dev is an unknown quantity at this point 
Solved Threads: 2
vicky_dev's Avatar
vicky_dev vicky_dev is offline Offline
Junior Poster in Training

Re: Running Java Program outside an IDE

 
0
  #18
Oct 6th, 2007
Originally Posted by masijade View Post
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\Current Version

Will give you the current version and

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\<current version>\JavaHome

Will give you the jre directory. Check up one level from that for a bin/javac to determine if it is a jdk. If that does not exist, then it is only a jre.

Edit: This is, of course, Windows only, which makes it paltform depedent. To try, first for platform independence, try searching for a jre or java on the path from a System.getEnv("PATH") call, but it is, obviously, not guaranteed to be found there. Otherwise, you can use the rpm command to find it on Linux, and pkginfo on Solaris. Other OSes, I couldn't tell you. None of these, however, are truely satisfactory.
Thanks again... The registry keys were exactly what I was looking for. Well my app is required to run only on Windows, so platform-independence is not an issue right now. I chose Java simple because it is easy to program in.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC