Member Avatar for iamthwee

Hi, I so close to getting this to work. Basically, I trying to wrap my program up in a jar file. So that wen i doulbe click it, it executes. Much like c/c++ programs do.

I can jar it up from the command line, but when i double click it it gives me errors. Please help, I be soooooooooo greatful.

My file is called ColorSlide.java.

To jar it up I use the command:

jar cf ColorSlide.jar ColorSlide.class

But when I double click it, and expect it to run it gives me this?


God bless.

Recommended Answers

All 8 Replies

Member Avatar for iamthwee

OMG THAT'S BRILLIANT!!!

I owe you server big time. I was tearing my hair out.

To the guys at sunmicrosystems..Why is it so freaking complicated?

One other thing. I know jwenting mentioned something about needing the jvm, (java virtual machine) for it to run on other machines.

I was planning to drop the jar executable into a floppy and take it to my friends computer. Do they need the java plugin to run it? And is that the same as the plugin needed to view applets?

God bless.
:cheesy:

You would need to download the JRE, but I'd say your friend probably has it. If he don't, then it's no big deal to download it.

complicated? A single line in a config file (which is what the manifest is) is complicated?

Member Avatar for iamthwee

complicated? A single line in a config file (which is what the manifest is) is complicated?

Maybe I'm missing sumthing.

But I had to use three commands to get it to work.
First I had to jar it...

jar cvf ColorSlide.jar ColorSlide.class

Then extract it...

jar xvf ColorSlide.jar

Then open the manifest file and by freakin hand, insert the line:

Main-Class: ColorSlide

Without the .dotclassextension

Then make it executable...

jar cvfm ColorSlide.jar MANIFEST.MF ColorSlide.class

For someone who has never worked from the command line b4
... that's complicated. ;)

C/C++ on the other hand. All you have to do is compile and run it and the executable automatically appears in your folder.
That's simple.

The first 2 commands aren't needed.
You could have just created the manifest file yourself, everything in it except that single line is just comments and not needed.

Member Avatar for iamthwee

The first 2 commands aren't needed.
You could have just created the manifest file yourself, everything in it except that single line is just comments and not needed.

Sweet...

Ok, how do I add my own icon to the executable, and is the java Run time environment the same as a 'java plugin' the same thing that is used to view java applets?

God bless.

:cheesy:

Not sure how and if you can set a custom icon on a jarfile. You'll have to search for that.
The Java plugin is the browser plugin which is (usually) installed as part of the installation of the Java runtime environment (and uses the JRE internally).

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.