aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How to run a java jar file from Eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to run a java jar file from Eclipse?" Watch "How to run a java jar file from Eclipse?" New topic
Author

How to run a java jar file from Eclipse?

Robert Van Liew
Greenhorn

Joined: Feb 24, 2012
Posts: 2
Greetings,

I realize this same topic was covered briefly here:

http://www.coderanch.com/t/419486/vc/Run-jar-file-eclipse

However, I do not have the "Run Configurations" menu option, which is said to be the solution (you can see my "Run" menu options in the screenshot below). I'm running Eclipse 3.3.2.

I'm rather new to java, having worked with it for a couple months, and so that post is not in-depth enough for me to understand. I know the java language itself fairly well, but when it comes to compiling files, and creating/understanding how deployed java applications work, I have almost no knowledge. I also am rather new to Eclipse, having only worked with it for one project for a couple of months, where I had access to source code.

I have now been tasked with making modifications to an in-house java application. However, we do not have the source code, which has somehow been lost ಠ_ಠ. Eventually, I'm going to have to learn how to decompile the class files in the jar, but first things first: I need to figure out how to run the application from Eclipse.

I've organized the files like so in Eclipse (the project is called hbks registrar):



This is how the application appears to end-users when they use it:



The .jar file contains all the compiled classes of the application in it. The .bat file is what users double-click to start the application. The .bat has a single line of code:



So, it goes into the jar file and starts up the HOTTBooksClass class file.

The four other folders I've included in the project are folders referenced by the application. The "lib" folder contains other jars needed by the class files.

So, my question is: How can I run the application from Eclipse? I've tried clicking the .bat and .jar files in the explorer window and running them, but I get errors. Can someone please walk me through what I need to do?

I'm guessing I have to use this "Run Dialog" screen (shown below):



but I have no idea what to do there.

Thanks so much in advance,

-Robert V

NOTE: This is my first time posting on these boards. If I am doing something against normal "posting etiquette", like maybe you guys prefer links to images instead of the actual images, please let me know.

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

First, your version of Eclipse is really old. Eclipse is now up to version 3.7. Here here is a caveat: some of the menus and selections I refer to might not be in your version.

Second, to run an app, all you need is a class that has a main() method in your project. Then you you can right-click the project and select Run As | Java Application. If, however, you have multiple classes with a main() method, there is some additional configuration.

You might want to go through the tutorials in the help text: Help | Help Contents | Java Development User Guide | Getting Started


JBoss In Action
Robert Van Liew
Greenhorn

Joined: Feb 24, 2012
Posts: 2
Alright, I'll look into it on Monday, and post updated questions then if necessary.

Thanks!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

I think the "Open Run Dialog" is the old name for Run Configurations, but definitely go for a more up-to-date Eclipse.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run a java jar file from Eclipse?