0

I have created a Java console application using Netbeans. In the Netbeans dist directory I have the class file of the project. Now I need to give the executable files to someone else who will run them on another PC.

Which file I should send? How can he run them on his PC? Is there any way to create an exe type file?

Both PCs have the JDK installed.

5 Answers 5

3

Build a jar file with a main class specified in it.

If he has Java installed and .jar is associated with that, he should be able to just double-click on it.

Alternatively from a command line he'd be able to run:

java -jar program.jar

There are programs around to create executable wrappers around this, but a jar file is a simpler solution in terms of packaging - it's worth trying that to start with.

Sign up to request clarification or add additional context in comments.

Comments

0

In additon to Jons answer:

If you have a runnable jar to start with, it is frequently much easier to package it up in an EXE file. If you have the need search Stackoverflow for JSmooth and one-jar.

Comments

0

NetBeans actually answers your question. If I do a Clean/Build, the output says:

To run this application from the command line without Ant, try: java -jar "insert_your_project_name_here.jar"

Comments

0

theres a handy page about this here:

java tools tutorial

It describes creating jar files a little further down the page

Comments

0

You can go to run menu and select clean and build project or shift+f11 after this go to dist folder in project folder and use .jar file and run that by hint say in over .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.