I have made a program in BlueJ using several attributes such as Arrays, Strings etc. I want to know a way in which I can execute this program in any Windows based application or any other platform than BlueJ so that it can be used by people. Any ideas?

Dani AI

Generated

Brief, practical checklist to follow after the jar creation attempts already suggested by and the folder checks noted by . These steps focus on causes that often get missed when a jar "does nothing" on double-click or the runtime reports it cannot access the file.

  • Confirm the file you think is on the Desktop is actually a real jar file: turn on Explorer's "Show file name extensions" so the full name is visible. Files created by mistake can end up with hidden double extensions (for example "data.jar.zip") or as shortcuts.
  • Inspect the jar with an archive tool (7-Zip/Windows Explorer) to make sure it contains compiled .class files and a META-INF folder. A 0-byte file or a jar that contains only .java sources will not run.
  • Check Windows file properties for an "Unblock" option (files created or downloaded can be blocked by Windows security). Also verify the file size and that antivirus hasn’t quarantined or locked the file.
  • Try moving/renaming the jar to a simple path (for example C:\temp) to eliminate path/permission quirks and spaces-in-path issues.
  • If double-click still does nothing, Windows may not have an association for .jar set to the Java runtime. Use "Open with..." and point to the Java runtime's GUI launcher (javaw.exe in the JRE bin) or create a small wrapper (batch or an exe wrapper like Launch4j/JSmooth) so users can double-click without needing a console window.
  • If your project uses external libraries, BlueJ may not have bundled them; confirm all required libraries and resources are inside the jar or packaged with an installer.

These checks resolve most "won't run outside BlueJ" cases. If the jar contains valid .class files and a proper runtime is associated, wrapping it as an .exe or building a simple installer is the usual way to distribute a click-to-run app to Windows users.

Recommended Answers

All 7 Replies

you mean how to distribute it? create a .jar file, that way, your application can be run on clicking it. (that is, provided the jre is present and installed, of course. no jvm? no running java application)

I have just made a simple program in BlueJ editor. Now I want it to run on any platform without the BlueJ terminal window. I tried creating a jar file but that isnt helping. Clicking it doesnt perform any action. I have the jdk and jre installed and updated.

Does your jar file have a correct manifest file with a Main-Class: entry? You will need that to execute a jar file with the java -jar option.

What error message do you get if you open a command prompt, change to the folder with the jar file and enter:
java -jar <THEJARFILENAME>.jar

On Windows: To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

C:\Users\Shaswat\Desktop>java -jar data.jar
Unable to access jarfile data.jar

C:\Users\Shaswat\Desktop>set path=C:\Program Files\Java\jdk1.6.0_02\bin;%path%

C:\Users\Shaswat\Desktop>java -jar data.jar
Unable to access jarfile data.jar

You must be in the same folder with the data.jar file so the java command can find it.
Use the CD command to change to the directory with the jar file.

I am in the directory with the jar file. Not in the folder. My jar file is saved in the Desktop itself and I am in that directory. I tried executing the jar file from the parent directory (Shaswat) of the Desktop and still the same error is coming.

To see what files are in a folder use the dir command. That will list the folder's contents.

I am in the directory with the jar file. Not in the folder.

I use the terms directory and folder to mean the same thing.

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.