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?

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.