Socratic Phoenix
Socratic Phoenix

Reputation: 556

Java program without command line

I'm working on a simple chatBot, just as a learning experience, and have hit a block. I have a rudimentery GUI setup that launches when I run the program with the command line, but not when I double-click the Jar. I am either missing code or exporting/running the program incorectly. Im using eclipse and exporting as a runnable jar. If anyone could point me towards a tutorial or some code that would be greatly appreciated.

Clarification... I want my chatBot to open a GUI when double-clicked, similar to the minecraft-server jar

EDIT I figured out what was wrong, it had nothing to do with the manifest or code... I was just executing a while loop wrong, I feel dumb now :(

Upvotes: 0

Views: 107

Answers (2)

Rahul Winner
Rahul Winner

Reputation: 430

I second to Jason. Alternatively you may create one batch file (.bat) unless you want to make it work even on Linux (in this case you would .sh file).

Upvotes: 0

Jason
Jason

Reputation: 11822

In order to make your jar 'runnable' in the command line, you need to specify which class is the main class to execute.

This is done by specifying a manifest.txt file that contains the following line:

Main-Class: the_package_and_name_of_your_main_class

How this manifest file is added to your jar depends on your build tool.

Upvotes: 2

Related Questions