Jump to content
xisto Community
eldeo

Auto Run Java Program Run Java program on double click

Recommended Posts

If you want to run your Programm under Windows, you should try JSmothGen! Its open source and it generates an exe file whitch then locates the JVM in the system and starts teh specific class file which inherits the main method!

Share this post


Link to post
Share on other sites

If you want to run your Programm under Windows, you should try JSmothGen! Its open source and it generates an exe file whitch then locates the JVM in the system and starts teh specific class file which inherits the main method!

<{POST_SNAPBACK}>


 

Is it spelt "JSmothGen"? I tried to search on google with the same keyword but did not find any matches...

If possible pls give me the website address where I can download the tool.

Share this post


Link to post
Share on other sites

Is it spelt "JSmothGen"? I tried to search on google with the same keyword but did not find any  matches...

If possible pls give me the website address where I can download the tool.

<{POST_SNAPBACK}>


Hi buddy

 

it not "JSMOOTHGEN" but it is "JSMOOTH" .exe converter of java application for MS windows its an open source project you can get it at "jsmooth.sourceforge.net"

and if you want more information or more tools just give these key words in google you will get lots of links ,

 

KEY WORDS

1) java application installer

2) Java to exe

 

what else do you wanna know

 

Cheers

Arunkumar.H.G

Share this post


Link to post
Share on other sites

Dear Friend!I am new to java. and i have tried the below problem. as a usual time i use ms-dos to command java, javac it look like thisc:>\java\bin\javac test.java (this i do a compile for my java file)c:>\java\bin\java test (this i do a run for my class file)I wonder if anyway just double click on test.java then it compile for me without going to ms-dos and run javac?I also wonder if anyway just double cick on test.class then it will run to let me see the work?I hope everyone may response to these two problems.Thanks & Best Regards,Dorei

Share this post


Link to post
Share on other sites

Yeah, I think that is possible...Just right click on .java file and select open with...from the list select javac.exe (if it exists) or browse to it and select it.chek the box.. always open with... and there u r....double click and it should compile... I have not tried it yet.. but should def work...similarly for class files.. associate it with java.exeIf these dont work... i suppose u can write a batch file.. which compiles and runs both...There is sthg u can do in the registry so that in the context menu u get compile and it would compile with javac.exe wud try out and let u know..

Share this post


Link to post
Share on other sites

Hi, I have tried so many times, but it is not run that way. when i double click on it, it gone to be open the dos then exit. I wonder if i have another way.Thanks & Best Regards,Dorei

Share this post


Link to post
Share on other sites

Yeah, I think that is possible...

 

Just right click on .java file and select open with...

from the list select javac.exe (if it exists) or browse to it and select it.

chek the box.. always open with... and there u r....

double click and it should compile...

 

I have not tried it yet.. but should def work...

similarly for class files.. associate it with java.exe

 

If these dont work... i suppose u can write a batch file.. which compiles and runs both...

 

There is sthg u can do in the registry so that in the context menu u get compile and it would compile with javac.exe

wud try out and let u know..

<{POST_SNAPBACK}>

I've tried this method...

It's normal when the DOS window open and exit. Once the DOS command finishes the window will be closed automatically.

And in fact I don't recommend this method since you won't be able to read the error messages from the compiler, although you will still be able to compile the program.

Also note that you won't be able to run the program just by "associating it with java.exe". Reason? Do you remember after you compiled the program successfully (e.g. javac testprog.java), what's the command you need to type in order to interpret (execute) the program? It's (javac testprog). You can't include the ".class" when executing the program, or you'll get an error message. And when you associate a file with a program, Windows just append the filename to the end of the program. So when you associate that *.class file to java.exe and you run testprog.class, you will get "java testprog.class" - it won't work. Try it on your own.

 

Hi,

I have tried so many times, but it is not run that way. when i double click on it, it gone to be open the dos then exit.

 

I wonder if i have another way.

 

Thanks & Best Regards,

Dorei

<{POST_SNAPBACK}>

Like cse-icons said, create a batch file to handle the task. But the easiest way may be to simply use an IDE to write and compile the program.

 

 

** Edit

Create a batch file to do the task:

Save the following code to runjava.bat under folder C:\j2sdk1.4.2_04\bin

@echo off[br]title Java Compiler[/br]if "%1" == "" goto Help[br]echo Compiling...[/br]javac %1.java[br]if ERRORLEVEL 1 goto Error[/br]echo Compile successful. Running program...[br]java %1[/br]goto End[br]:Help[/br]echo Compiles and run a java program.[br]echo.[/br]echo RUNJAVA [filename][br]echo.[/br]echo   [filename]   File name of the java source code (without .java extension)[br]goto End[/br]:Error[br]echo *** Compile failed ***[/br]:End[br]
[/br]What a long post... ;)

Share this post


Link to post
Share on other sites

If you system is linux, you can use cron job to do the same thing. It is a tool to start specified program at specified time continuouly.

 

You can use

 

crontab -l

 

to show the existing cron job.

 

You can also use

 

crontab -e

 

to configure it.

 

the job definition can be divided into two part. One part is the time schedule definition. You can specify the year/month/day/weekday/hour/minute/second. One part is program definition. It is same as your command line, such as java -jar run.jar.

 

 

You can also run java program as a windows service. Use javaservice free tool

27108[/snapback]

Share this post


Link to post
Share on other sites

About jar

Auto Run Java Program

 

While creating jar file I faced a problem that is could not find main class ,the program will exit

 

-reply by Giri

Share this post


Link to post
Share on other sites

There are also some tools that help you convert a jar to an exe. Although it isn't indicated ... But still... nice to know :angel:

Share this post


Link to post
Share on other sites

May I also recommend JARMaker?

http://forums.xisto.com/no_longer_exists/

And Jar2Exe?

http://www.jar2exe.com/

Of course, if you're talking about hiding the window while you're running it just use javaw:

@echo offstart javaw Main

Otherwise you can do:

@echo offtitle Runjava -Xmx256m Mainpause

I don't understand the point of jarring it unless you're going to be distributing it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.