Hi

Can anyone please tell me whether I can write a java program and start it in a way other that involves the command line? And not applets either.

I want to start writting all of our company software in java, leaving behind c#. But the problem is I can only run java programs from the command line using the java command. End users will not like this.

Is there anyway to make java programs more user friendly By providing a shortcut on the desktop and adding it to the start menu.

Thanks in advance
Rav Wolf

Yeh compile it and use the *.jar file. All the java command does is compile it? Could be wrong here.

I am not sure if you are right.

the javac command compiles it. the java command starts the virtual machine, load the specified class and invoke function main. in other words its the same as clicking a program icon on the start menu.

Hi Rav Wolf ,
when you compile your java code , a .jar file is created .. then you can use any of the progras that converts jar to exe such as "installJammer" , InstallJammer creats a .exe file from the .jar file ..

I hope i helped you ..
any question i'll be there .

thanks

best regards.
eng.Hosam

thanks. i'll go check it out. will get back to you hopefully soon. thanks again.

@acidburn.
thanks to you too. it seems you were on the right track.

cheers

Hi Rav Wolf ,
when you compile your java code , a .jar file is created .. then you can use any of the progras that converts jar to exe such as "installJammer" , InstallJammer creats a .exe file from the .jar file ..

I hope i helped you ..
any question i'll be there .

thanks

best regards.
eng.Hosam

when you compile, a .class file is created. not everyone uses an ide which automatically generates .jar files. a.jar file is basically a structured .zip file, used as a executable file for java progs

If you want to create a jar very easily, one way you can do it is by using the Eclipse IDE. To create a jar in eclipse,

file-> export -> Jar File (this might be listed under 'java' -> next, and under manifest class you would select the main class that you want to run when the program is started,.

There is no reason you need to create an .exe from the jar file (and many reasons not to). Just read the tutorial on packaging applications as jar files: http://java.sun.com/docs/books/tutorial/deployment/jar/index.html

For your shortcut, you can simply use the same syntax that you would to run it from the command line. If you don't want the command window to persist while it's running, use "javaw" instead of "java"

javaw -jar MyApp.jar

. You can add any switches you might need.

If you want to provide an installer for the app, you might take a look at IzPack.

hi. ! can anybody tell me how can i construct menu in a simple java program..in which i use switch statements for addition,multiplication and subtraction purposes. i will be very thankful to u..... shruti thakur.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.