Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help me run this applet

 
mandy roberts
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Winston Gutkowski
Bartender
Pie
Posts: 10111
56
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
mandy roberts
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
this is error when . jar file is trying to run after i click run on java applet
[Thumbnail for 2012-07-27_233839.jpg]
 
Tushar Kapila
Ranch Hand
Posts: 35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)



 
mandy roberts
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??..



2012-07-28_103634.jpg
[Thumbnail for 2012-07-28_103634.jpg]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic