pk55200
asked on
java app --> .exe file
I have 1 standalone application (public static void main{ args [])). I need to deploy this as a standalong, single .exe file format.
Anyway to do ?
This is because I need to use Window technology to schedully run this application.
How can I do?
1. convert the .java or .classs to .exe file?
2. How can I make this .java/.class to be run schedulely?
Anyway to do ?
This is because I need to use Window technology to schedully run this application.
How can I do?
1. convert the .java or .classs to .exe file?
2. How can I make this .java/.class to be run schedulely?
@echo off
REM Runs the following Java class
java -classpath c:\somepath SomeClass
REM Runs the following Java class
java -classpath c:\somepath SomeClass
CEHJ is right but you can also compile you app as an executable JAR file. Check out the SUN forums java.sun.com
>>you can also compile you app as an executable JAR file
That would still need a batch file for scheduling AFAIK
That would still need a batch file for scheduling AFAIK
you dont need a batch file to run it.
use windows scheduler
ie. in windows xp :
start | programs | accessories | system tools | scheduled tasks
and add a scheduled task.
use windows scheduler
ie. in windows xp :
start | programs | accessories | system tools | scheduled tasks
and add a scheduled task.
writing a batch file is always safer than relying on Windows file-type associations.
so, i would recommend a batch file even with an executable jar file.
or simply use the java.exe in your scheduler with the class as parameter:
example: C:\J2SDK1.4.1\bin\java.exe <myclass>
so, i would recommend a batch file even with an executable jar file.
or simply use the java.exe in your scheduler with the class as parameter:
example: C:\J2SDK1.4.1\bin\java.exe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hey qwerty29, excelsior is slower
i use excelsior - my .exe applications are faster then the .jar - bur also bigger (8 MB)
> or simply use the java.exe in your scheduler with the class as parameter:
In the scheduled task wizard,
Select the program you want to use: browse and select C:\J2SDK1.x.x\bin\java.exe
Enter all the other needed information in the other wizard pages
when your task is created, open the task properties (right click -> properties)
and modify the "Run" to run your java class, something like this:
C:\J2SDK1.x.x\bin\java.exe -classpath c:\somepath SomeClass
you are done. no need to build an exe, no jar file required, no batch file required.
In the scheduled task wizard,
Select the program you want to use: browse and select C:\J2SDK1.x.x\bin\java.exe
Enter all the other needed information in the other wizard pages
when your task is created, open the task properties (right click -> properties)
and modify the "Run" to run your java class, something like this:
C:\J2SDK1.x.x\bin\java.exe
you are done. no need to build an exe, no jar file required, no batch file required.
It's probably still better to have a batch file (you could create a 'tasks' directory containing scheduled batch files) providing a layer of indirection.
For instance, say you have a regular task and you decide to upgrade to java 1.5 when it comes out. If you are using java.exe directly, by selecting it as has been suggested, you're going to have a problem. Using a batch file will give you an insulating layer of indirection.
For instance, say you have a regular task and you decide to upgrade to java 1.5 when it comes out. If you are using java.exe directly, by selecting it as has been suggested, you're going to have a problem. Using a batch file will give you an insulating layer of indirection.
Hello there " pk55200 ";
1.) 1st of all if you want to create an executable format on a .java program what you need
to do is to create a " .jar file " an executable form of java.
Here's a guide where you can learn how to create a executable file or jar file.
http://java.sun.com/docs/books/tutorial/jar/basics/build.html
If you decided that you want to create an installer for java go to www.zerog.com and
download InstallAnywhere.
2.) To your second question however all of the recomendations of experts here are all correct.
Thank you & good luck . . .
1.) 1st of all if you want to create an executable format on a .java program what you need
to do is to create a " .jar file " an executable form of java.
Here's a guide where you can learn how to create a executable file or jar file.
http://java.sun.com/docs/books/tutorial/jar/basics/build.html
If you decided that you want to create an installer for java go to www.zerog.com and
download InstallAnywhere.
2.) To your second question however all of the recomendations of experts here are all correct.
Thank you & good luck . . .
ASKER
Ha.... such a nice and interesting talk with all of you.
>>Just use a batch file and schedule that to run
CEHJ, TQ to be the first to reply to my message. Thank you.
It's seems that you have mentioned couple of time on this "BAtch" jobs. May I ask how can I make my application as bactch job? For my definitions, batch job is something like schedulely run my program and normally run with the huge amount of volume. But anyway, please guide me how can I "make" my application to run as batch and how to "schedule" it to run? Any extra code need to be done?
ibo, GrandSchtroumpf, TQ. At first relaying on the Windows scheduler is the first option in my mind. But frankly speaking, I agree with GrandSchtroumpf, Window OS is not very stable... I think all of yo agree with me.... Currently one of out ecom system is using this window scheduler to run, yet hell a lot of program... :-) Anyway, no harm knowning how to set the things up.
qwerty29. TQ for the URL. Will try that.
GrandSchtroumpf, I not sure how this work. But maybe the URL suggested by other can helo me to answer this. How to shcedule the task.
OK. This is what I do. I am using XP Profesional.
1. I go to start | setting| contropanel | scheduled tasks
2. Click the "Add New Scheduled task"
>>Just use a batch file and schedule that to run
CEHJ, TQ to be the first to reply to my message. Thank you.
It's seems that you have mentioned couple of time on this "BAtch" jobs. May I ask how can I make my application as bactch job? For my definitions, batch job is something like schedulely run my program and normally run with the huge amount of volume. But anyway, please guide me how can I "make" my application to run as batch and how to "schedule" it to run? Any extra code need to be done?
ibo, GrandSchtroumpf, TQ. At first relaying on the Windows scheduler is the first option in my mind. But frankly speaking, I agree with GrandSchtroumpf, Window OS is not very stable... I think all of yo agree with me.... Currently one of out ecom system is using this window scheduler to run, yet hell a lot of program... :-) Anyway, no harm knowning how to set the things up.
qwerty29. TQ for the URL. Will try that.
GrandSchtroumpf, I not sure how this work. But maybe the URL suggested by other can helo me to answer this. How to shcedule the task.
OK. This is what I do. I am using XP Profesional.
1. I go to start | setting| contropanel | scheduled tasks
2. Click the "Add New Scheduled task"
ASKER
sorry.....
3. go to C:\jdk1.3.1_07\bin\java.ex e
4. there will another window come out.
4.1 Run : C:\ABC\TestingApplicationF older\myFi le.java
Start in : C:\jdk1.3.1_07\bin\
Am I right?
3. go to C:\jdk1.3.1_07\bin\java.ex
4. there will another window come out.
4.1 Run : C:\ABC\TestingApplicationF
Start in : C:\jdk1.3.1_07\bin\
Am I right?
Not exactly.
It's confusing because of this wizard.
If you have created a task, open its properties.
"Run" should contain this text:
C:\jdk1.3.1_07\bin\java.ex e C:\ABC\TestingApplicationF older\myFi le.java
"Start in" can contain anything you want.
What i meant by <relying on windows file associations> was relying on the fact that your jar file will launch when you double-click on its icon.
You will need to rely on windows scheduler no matter which solution you choose. If you create a batch file, the scheduler will need to launch the batch file. If you create an exe, the scheduler will need to launch the exe.
It's confusing because of this wizard.
If you have created a task, open its properties.
"Run" should contain this text:
C:\jdk1.3.1_07\bin\java.ex
"Start in" can contain anything you want.
What i meant by <relying on windows file associations> was relying on the fact that your jar file will launch when you double-click on its icon.
You will need to rely on windows scheduler no matter which solution you choose. If you create a batch file, the scheduler will need to launch the batch file. If you create an exe, the scheduler will need to launch the exe.
>>please guide me how can I "make" my application to run as batch
Well, i'd only be repeating some of the answers above about setting the job in the gui largely, but the difference would be to do first
1. Create a 'Jobs' directory
2. Put in a new batch file for your job as i mentioned earlier
3. Select the file in the gui as mentioned above
The reason for doing it this way i explained at 09/10/2003 07:08AM PDT
Well, i'd only be repeating some of the answers above about setting the job in the gui largely, but the difference would be to do first
1. Create a 'Jobs' directory
2. Put in a new batch file for your job as i mentioned earlier
3. Select the file in the gui as mentioned above
The reason for doing it this way i explained at 09/10/2003 07:08AM PDT
This sounds promising- I'm about ready to use it myself, meaning I don't have any experience with it yet...
http://www.bysoft.se/sureshot/exej/
exeJ v1.01 FREE
exeJ is a command line tool that creates a "batch-like" executable (.exe file) for your java application. The command line used to start your java application is wrapped in the generated executable and the user can simply start the java application with a double-click.
The generated .exe is Windows 95/98/ME/NT/2000/XP compatible.
The target system must have JavaSoft JRE installed.
More info
Read more in the online manual and FAQ.
http://www.bysoft.se/sureshot/exej/
exeJ v1.01 FREE
exeJ is a command line tool that creates a "batch-like" executable (.exe file) for your java application. The command line used to start your java application is wrapped in the generated executable and the user can simply start the java application with a double-click.
The generated .exe is Windows 95/98/ME/NT/2000/XP compatible.
The target system must have JavaSoft JRE installed.
More info
Read more in the online manual and FAQ.
Just use a batch file and schedule that to run