| | |
Running Java Program outside an IDE
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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.
•
•
•
•
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.
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
----------------------------------------------
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
•
•
Join Date: Oct 2006
Posts: 101
Reputation:
Solved Threads: 4
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.
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.
•
•
Join Date: Sep 2007
Posts: 27
Reputation:
Solved Threads: 3
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.
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.
Download java source code examples from http://java-assignment.com/
N Puzzle game, Magic squares, Huffman compression techniques, ...
N Puzzle game, Magic squares, Huffman compression techniques, ...
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.
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.
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.
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
----------------------------------------------
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
•
•
•
•
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.
![]() |
Similar Threads
- put the Dos 's command into java program? (Java)
- Running java command thru java program (Java)
- JAVA program help (Student/Grades) (Java)
- Help with a java program home work assignment (Java)
- Wierd Numbers appear when trying to run a running product in a C++ program (C++)
- error on running the parallel program (Java)
Other Threads in the Java Forum
- Previous Thread: Need Help.. please? :D
- Next Thread: Paint Application In Java
| Thread Tools | Search this Thread |
android api applet application array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) calculator chat class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors event eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia link linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing threads time tree unlimited webservices windows






