i want to run my java program as autorun as plug in the usb but i cant figure out hopw to. i am come out with a method below it is

[autorun]
open=fun.java // my program name
action=Run fun Program
icon=fun.exe
label=extemer

i made this file in notepad and saved it with autorun.inf in the usb device and after that when i plug in usb again it didnt work

What about first closing the other thread where you got original idea? Closing thread is minimum you can do acknowledge that somebody did helped you and get some credit for it....

>open=fun.java // my program name

You cannot run ".java" files. You can run classes or jars.

peter_budo i did it before but the part i am trying to do is it to autorun on a usb drive

i just made a jar file. then did it like this below and save it in the usb but its not working.i saved that jar file in the usb also but still not showing anything
[autorun]
open=java-jar jarf.jar
action=Run jarf Program
icon=jarf.jar
label=extemer

Is the problem with the command you are trying to execute or with the OS reading the autorun file and properly trying to execute some command.
For example what happens if you use open=Notepad.exe?

it will autorun notepad in the autoplay option

How did you test this command line: java-jar jarf.jar
that you want to use.
The missing space gives a problem:

D:\JavaDevelopment\Testing>java-jar jarf.jar
'java-jar' is not recognized as an internal or external command,
operable program or batch file.

D:\JavaDevelopment\Testing>

i got this way on google and jarf.java is mine file

Did you see my last post?
How did you test this command line: java-jar jarf.jar

peter_budo i did it before but the part i am trying to do is it to autorun on a usb drive

You are ignorant fool. Close the other thread! Forum rules clear states

Do not post the same question multiple times

. Your present question is just plain continuation of your other thread with which you should have been continuing....

i need to be guide so please juz ans

Why didn't you answer my question?

How did you test this command line: java-jar jarf.jar

i didnt get your question you mean to say that is this jar file excutes perfectly or not.if you asking this yes it display the output perfectly as i click on it

I guess you need glasses. Here is the results I get when I entered that command:

D:\JavaDevelopment\Testing>java-jar jarf.jar
'java-jar' is not recognized as an internal or external command,
operable program or batch file.

D:\JavaDevelopment\Testing>

Man i think you dont have any info anout it how the hell can you run a file which you wont have jarf.jar is mine file name and you giving the same name.

commented: that is not he way to behave -3

Calm done.
If you can read my post you will see that the problem is the command: java-jar is not found. There needs to be a space between java and -jar.
Your posted contents of the autorun file did NOT have a space there!!!

commented: Some people just make it so difficult to help them. +14
commented: thanx for being so cool. +12

Man i think you dont have any info anout it how the hell can you run a file which you wont have jarf.jar is mine file name and you giving the same name.

You are not trying out what people are suggesting or asking you to try and provide them with results. You are absolutely ignorant and expect that answer would be given to you on big golden plate with even bigger red ribbon wrapped around it, making it a beautiful present. Stop insulting people and provide them with answers to what their asking, plus provide relevant info you are asked for.

peter you just keep out.the way you talk to me saying "ignorant fool" in your last reply you just shut up.you dont even know the rule yourself just apply on yourself

commented: Don't mess with Peter Budo -1
commented: Don't insult others for the things that you're responsible for! -2

NormR1 sorry i was little harsh...ok coming to your question i write this code in notepad and though i copy the file in usb but no result in the autoplay option.HAVE you done autorun in usb before.I autorun my this program on the windows startup but didnt getting the point how to do it on usb just stuck little in it.

Quick search would brought you following entry that points out few issues with launching Java app from USB stick.

PS: Lots of change in your attitude since my last post. Good sign, commenting on rules pointless... If you unhappy about my approach you can always complain in DaniWeb Community Feedback Forum or report my post. Nevertheless be aware of false reports you may make.

Still no reply for my question about the command: java-jar
as shown in extemer's post: open=java-jar ...

There is NO command: java-jar on my system. Is there one on yours?

no mine is not showing that error

Then you are not typing the same thing between console and forum posts since as NormR1 already stated you will get error and java command is used as

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
meaning java -jar NAME_OF_JAR_FILE

mine is not showing that error

extemer could you open a command prompt window and enter this command and copy and paste here what you get when you enter the command: java-jar
Notice there are no spaces in the 8 characters in the command.

'java-jar' is not recognized as an internal or external command,
operable program or batch file. normR1 i am getting this error

but when i wrote jarf.jar.Then file excutes perfectly in command prompt

What command was in the autorun file? Was it open=java-jar?

yes it was java-jar filename.jar

So that would never work, unless you have a command: java-jar on your system.

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.