• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

run a java application in Windows

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody. I'm new in java and in programming languages. I study java for many hours per day but i have a lot of questions. Suppose i create a java application with Eclipse . Then this application after compiling becomes an application.class file.
How can i run this application under my OS (WIndows ?)I dont mean with javac or something like that but generally speaking.I mean for example a desktop application.
Can someone help me on this?
Thanks a lot Manos.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easiest way is to navigate to the folder the class file is in and then use: java application or you can run it by specifying the absolute path like this: java -classpath c/myPrograms/Program1 application
 
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are new to Java (and all programming languages in general) I would recommend not using Eclipse for a while. An IDE is a great tool, but you should learn the basics of the language before you start using a tool like that. I've heard good things about NotePad++, and if you search you can find quite a few more free development tools.

I think you can create a batch file that you can use to run a java program, basically having it call java ClassToRun.
 
Manos Kolias
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you be a little more specific please?
If for example i make an application like an agenda which holds dates scheduled events etc and i want this application to run under my OS or in someone else's machine how can i "do the connection"?.
 
Marshal
Posts: 28271
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "do the connection"? As far as how to run an application, what Andrew Robinson said is basically the answer, although you can do it in more complicated ways. And you do need to have a JRE installed on the machine where you plan to run the application.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Manos Kolias wrote:How can i run this application under my OS (WIndows ?)I dont mean with javac or something like that but generally speaking.I mean for example a desktop application.


Have a look at Sun's Java tutorials, they are quite good. You can run Java programs from the command line, as the Hello World tutorial explains in detail. If you don't want a user to have to use the command line, you can put the command to run the application in a Windows batch file, which you can run by just double-clicking the icon. You can also package the complete application in a JAR file, which you can read about in this tutorial (but it's a more advanced topic, I'd save that for later if you're still very new to Java).
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Manos Kolias wrote:Hello everybody. I'm new in java and in programming languages. I study java for many hours per day but i have a lot of questions. Suppose i create a java application with Eclipse . Then this application after compiling becomes an application.class file.
How can i run this application under my OS (WIndows ?)I dont mean with javac or something like that but generally speaking.I mean for example a desktop application.
Can someone help me on this?
Thanks a lot Manos.



You can double click the jar file and it will run just like any exe file in windows.
[Assuming you have java installed]
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
btw here are the settings to allow jar files to run in windows [you mostly dont need to configure this unless some zip application has hijacked the 'jar' extension]:


Tools > Folder Options > File Types > if existing then modify or click new...

File Type: Executable Jar file
Create an action called 'open'
Application used to perform action:
"C:\Program Files\Java\jre1.5.0_05\bin\javaw.exe" -jar "%1" %*
[assuming its in 'C:\Program Files\Java\jre1.5.0_05\bin']
check use DDE
Topic: System

Set 'open' action to default



 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic