aspose file tools*
The moose likes Beginning Java and the fly likes run a java application in Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "run a java application in Windows" Watch "run a java application in Windows" New topic
Author

run a java application in Windows

Manos Kolias
Greenhorn

Joined: Dec 08, 2009
Posts: 9
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.
Andrew Robinson
Greenhorn

Joined: Jan 06, 2010
Posts: 15
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
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
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.


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Manos Kolias
Greenhorn

Joined: Dec 08, 2009
Posts: 9
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"?.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14144
    
  18

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).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

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]


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

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



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: run a java application in Windows