Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing a jar file from another jar file

 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently using an applet to run a jar file named Loader.jar to run another jar file named ERO.jar, which is obfuscated. The loader loads fine, but it does not pop out the GUI as it's supposed to. Here's the HTML part of the loading:



When I normally run the ERO jar file, by using a batch file or double clicking it, it pops up a GUI I made to log in to a server. Although, when I run the HTML file to load the Loader.jar file, it runs as it should for the most part, but it won't pop up the GUI as it should. Here's a pic of it at the moment:

http://img97.imageshack.us/img97/9121/applet.png

It just stops there, but it won't pop up the GUI. The GUI looks like this:

http://img243.imageshack.us/img243/2332/loginei.png

When just by running a jar file normally, it works. But when running a jar file to run another one, it won't.

loader class (main class):
http://pastebin.com/3tMnKtt5

Bot class:
http://pastebin.com/Wycu6hFK

ProgressChecker class:
http://pastebin.com/4mHgvj9a

PreLoader class:
http://pastebin.com/pRr0cAs9

Updated class:
http://pastebin.com/jw86VvVp

Unpack class:
http://pastebin.com/u9Jh2Qak

Terminate class:
http://pastebin.com/FwkRQ5rS

GameFrame class:
http://pastebin.com/p0phfHjv

GamePanel class:
http://pastebin.com/nffxBw3H

Sorry for the classes being so long and having so many, but I just can't seem to figure out why it won't load the GUI properly. Help is appreciated. Thanks.
 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't it just be simpler to look at the error message? I haven't looked at any of that code, partly because it obviously contains a large amount of code which is irrelevant to the problem, but mostly because you need to see the error message before the code has any meaning at all with regard to solving the problem.

Edit: It also might help if you said what you mean by "run a jar file". I'm sure that half an hour of spelunking through pastebin might answer that question but it's more straightforward if you just tell us.
 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Wouldn't it just be simpler to look at the error message? I haven't looked at any of that code, partly because it obviously contains a large amount of code which is irrelevant to the problem, but mostly because you need to see the error message before the code has any meaning at all with regard to solving the problem.

Edit: It also might help if you said what you mean by "run a jar file". I'm sure that half an hour of spelunking through pastebin might answer that question but it's more straightforward if you just tell us.


There are no error messages from what I can see. It's just not loading the GUI. If I were to double click on the ERO.jar file, a GUI will show, the log in one. That's what I mean by running it. If I try to run a jar file to run another one, it won't load the GUI. It just stays at that same screen with the JProgressBar.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any exceptions would be showing in the Java Console.
 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Any exceptions would be showing in the Java Console.

Nothing in the Java Console. There are no errors, it just won't show the GUI or execute the ERO.jar file.
 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't want to look at all that code. Especially since with applets, it's almost always the configuration rather than the code which leads to problems. Your next step should be to write a short simple compilable example which does nothing except the bit which is causing the problem. That would be something which you could reasonably ask somebody to look at.

It's probably some simple configuration thing, like you don't have the ERO.jar file in the right place. I don't think it should take more than 50 lines of code to display what you're trying to do there, maybe even as few as 20.
 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I still don't want to look at all that code. Especially since with applets, it's almost always the configuration rather than the code which leads to problems. Your next step should be to write a short simple compilable example which does nothing except the bit which is causing the problem. That would be something which you could reasonably ask somebody to look at.

It's probably some simple configuration thing, like you don't have the ERO.jar file in the right place. I don't think it should take more than 50 lines of code to display what you're trying to do there, maybe even as few as 20.


The only thing really that's loading the ERO.jar file is a method. That's really it. Everything else is updates and checking on some stuff. The method I'm using to get the ERO.jar file is this:



The init() method for the applet is as so:

 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. You're trying to read from the client's file system, so have you signed the applet? If you haven't then that won't work. However you should get a security exception which is visible in the Java console in the browser.

Also I see that you're trying to read from the current working directory. Have you actually determined what the current working directory would be for the browser you're using, and put the jar file into that directory?
 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Okay. You're trying to read from the client's file system, so have you signed the applet? If you haven't then that won't work. However you should get a security exception which is visible in the Java console in the browser.

Also I see that you're trying to read from the current working directory. Have you actually determined what the current working directory would be for the browser you're using, and put the jar file into that directory?


The web client HTML file is in the same directory as the ERO.jar file, if that's what you're asking. I found out that it was downloading the cache, RARing it first and extracting it, and that's why it wouldn't pop out yet. Only problem is that an error occurred but it doesn't show it in the Java Console nor can I get into it. Every time I go to Tools > Java Console, and try to click it, nothing happens. I'm not sure, but a method I used to create a look and feel was this:



That code runs from a Theme.jar file, so would I have to put the Theme jarred file inside the cache file or put it in the same directory as the ERO.jar file?
 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Josh Rodrigues wrote:The web client HTML file is in the same directory as the ERO.jar file, if that's what you're asking.


Oh, you mean that ERO.jar is on the web server? But your code uses a File object to load it. That means you're looking on the client machine for it.
 
Josh Rodrigues
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Oh, you mean that ERO.jar is on the web server? But your code uses a File object to load it. That means you're looking on the client machine for it.


The Loader.jar file loads first, extracts the cache to the C:\ drive. Once done, it will run it and it runs fine now. Except it gives me an error. I'm guessing it's the Theme.jar file since I use the Theme file to run this code properly:

I'm guessing that the Theme.jar file isn't being found unless being put in the same directory as the ERO.jar file? Trying it out now and hopefully it works.
 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Josh Rodrigues wrote:I'm guessing that the Theme.jar file isn't being found unless being put in the same directory as the ERO.jar file? Trying it out now and hopefully it works.

That depends on what the manifest of ERO.jar says.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic