aspose file tools*
The moose likes Applets and the fly likes Please help me run this applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Please help me run this applet" Watch "Please help me run this applet" New topic
Author

Please help me run this applet

mandy roberts
Greenhorn

Joined: Jul 27, 2012
Posts: 6
What i am trying to achive is when someone click run on a java applet when it appears on my site -
it will run a java .jar file i have ...

This code below is from what i have found on the net, it runs a exe file which I DO NOT WANT ! ...

How and where can i modify this code please to run a java.jar file instead???.....

please not i have compiled this and it works as i said with exe file which ill state again is usless for me . i want this to run a java.jar file

below is the .jar file itself





This is the code i have to put in under the html page its self for this to execute
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 563
No need to SHOUT. In fact, SHOUTING may scare people away.

You've shown us what you found on the net, but what have you tried in the last week and what were the results? If you had errors or undesirable results, please post those.


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8427
    
  23

mandy roberts wrote:This code below is from what i have found on the net...

Well that sounds like the start of your problem right there. There's no point in plagiarizing code unless you understand how it works.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
mandy roberts
Greenhorn

Joined: Jul 27, 2012
Posts: 6
Greg Brannon wrote:No need to SHOUT. In fact, SHOUTING may scare people away.

You've shown us what you found on the net, but what have you tried in the last week and what were the results? If you had errors or undesirable results, please post those.

ok that code that i have posted above works 100% no issue at all . executes a exe file ........as i did say thats not what i want ......

the top part of the code is the name.java file .

the lower part is the code that goes on the html page obviously to execute the exe file after someone presses run... on the java applicate..

this is not what im after is to execute the exe

i want to execute the .jar file ,,,

but it does not work. so how would i modify this code to run a java.jar file instead of a exe file

this what happens when (after i press run on the java applet on my web site when i have the .jar file in drop box..

now as i said this works fine with a exe file no issues at all , again i dont want a exe to exucute .



sorry for caps i got really excited when i found this site sorry again mandy

so this is error when i click run on my web site trying to execute a .jar file thats coming from drop box link as you can see in second code for html page ...



[2012-07-27_233839.jpg]

Tushar Kapila
Ranch Hand

Joined: Dec 23, 2007
Posts: 35

you want to run an independent jvm or dynamically load some clases from jar to existing jvm (that is running applet) ?

if independent jvm - just point the exe to java.exe and pass parameters - class-path, main class name etc

but you will need to sign applet if running on others systems as Runtime is a special permission.

For dynamically loading classes you will need the URL to the jar, see URL class loader and you will need parameters to the main class and method to invoke (via reflection)




http://thehungersite.com | http://www.worldcommunitygrid.org/
mandy roberts
Greenhorn

Joined: Jul 27, 2012
Posts: 6
Tushar Kapila wrote:you want to run an independent jvm or dynamically load some clases from jar to existing jvm (that is running applet) ?

if independent jvm - just point the exe to java.exe and pass parameters - class-path, main class name etc

but you will need to sign applet if running on others systems as Runtime is a special permission.

For dynamically loading classes you will need the URL to the jar, see URL class loader and you will need parameters to the main class and method to invoke (via reflection)




i am able to sign the java that is no problem but i dont no how to recode this to do what you have mentioned

but its not going to execute a java.exe i want it to execute name.java file that will load into drop box .
maybe i have it mixed up and miss understood you

unless you me you name it java.exe to think it has to run it , im so confused
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

To run a JAR file, you're going to need to have a Java runtime installed on the machine where the applet is running. Of course since the applet is running, that means that there is in fact a Java runtime installed. So on to the next step: to run a JAR, the command is something like

java -jar your.jar

So that would be the command you'd have to run ("str5" in your applet code). However you can run into several problems there: for example you don't know whether "java" is actually in the user's PATH environment variable, so you might have to use the full path to the java.exe executable instead of just "java". And I'm sure there are other problems, you're just going to have to experiment on a variety of systems to make sure you get that all right.

mandy roberts
Greenhorn

Joined: Jul 27, 2012
Posts: 6
Paul Clapham wrote:To run a JAR file, you're going to need to have a Java runtime installed on the machine where the applet is running. Of course since the applet is running, that means that there is in fact a Java runtime installed. So on to the next step: to run a JAR, the command is something like

java -jar your.jar

So that would be the command you'd have to run ("str5" in your applet code). However you can run into several problems there: for example you don't know whether "java" is actually in the user's PATH environment variable, so you might have to use the full path to the java.exe executable instead of just "java". And I'm sure there are other problems, you're just going to have to experiment on a variety of systems to make sure you get that all right.


ok i tried this way , im not sure if this is what you mean .


but gave me this error when i tried both ways
as you see i tired

but i added that code only where i have marked in the above code is this where you want me to put it??..





[Thumbnail for 2012-07-28_103634.jpg]

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help me run this applet