ok.. now that I know about the JOptionPane, I have one more question. How can you create a real executable program from the java code that u write. IT can be executed through JCreator or another java creator, but how can you make it so that its an actual java application that runs on its own?
sorry if this is a stupid question...

Dani AI

Generated

Good start — pointed you in the right direction and showed how an IDE can build a JAR. Below is a compact, practical workflow and a few tips that fill the gaps people commonly run into when they want a Java program to behave like a normal desktop app.

Compile and package (minimal reliable flow):

  • Make sure your entry point is public static void main(String[] args) in a public class.

  • Create a manifest file containing a fully qualified Main-Class line (and end the file with a newline). Example:

    Main-Class: com.example.Main
  • Package with the jar tool (replace classes with the folder that holds your package dirs):

    jar cfm MyApp.jar manifest.txt -C classes .

Dependencies and “single-click” behavior:

  • If your app uses external jars, either list them in the manifest Class-Path (references to sibling jars) or produce an “uber”/fat JAR (tools: Maven Shade, Gradle Shadow or your build system) so java -jar finds everything in one file.
  • Test by running java -jar MyApp.jar. If you don’t want a console window on Windows use javaw -jar MyApp.jar or create a small launcher script (.bat/.sh) and make a desktop shortcut to that script.

Making it feel native:

  • Jar files don’t carry desktop icons by themselves. On Windows you can set an icon on a shortcut or wrap the JAR into an EXE with tools like Launch4j / exe4j / JSmooth. On macOS make an .app bundle (or use modern tools that create native installers). On Linux provide a .desktop file that calls java -jar.
  • For truly standalone installs (no JRE requirement), look at packaging tools that bundle a runtime image (modern JDKs include jlink/jpackage or equivalents in your build toolchain).

Troubleshooting notes:

  • Use the fully qualified class name in Main-Class. Check package directories inside the JAR. If double-click does nothing, run from a console to see the error message. If distributing widely, test on a target machine that doesn’t have your IDE installed.

Recommended Answers

All 5 Replies

Make an executable jar or a jnlp.
But anyone with an installed JRE can run a Java application if they know the name of the class that contains the main method (or you provide a batchfile or other startup script for their OS).

If you had tried to learn to use the compiler and runtime instead of which button to press you'd have known that.

can JCreator make executables or just execute them? how can u make one that you could give an icon and put on ur desktop?

can JCreator make executables or just execute them? how can u make one that you could give an icon and put on ur desktop?

He just told you!

ya- You must create a jar file through JCreater(eaiest way)
Go to configure-options-tools; Click new then 'Create new Jar File'. Then press ok. You can then create a jar file by pressing 'control + 1'; Then your jar file is created, and all you have to do is add your class path to the manifest file

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.