• Post Reply Bookmark Topic Watch Topic
  • New Topic

Launch servlet container from usb drive with batch script  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, my question is quite simple, but i think that the answer it'll not.
For the presentation of my work i would to start a Apache Tomcat Servlet container installed on a USB flash drive, that contains a deployed web application. And at the end of starting fase open a browser with the correct url.
I don't have experience with batch script, but i think it's possible ...
Have any of you done something similar?
Thank's in advantage.
 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is possible on Linux (never was as far as I can tell). It is possible in Windows XP through Vista (as long as it hasn't been disabled it which they should be) and is no longer in Windows 7. As far as I can tell, the best you will be able to do is navigate to the USB and launch the batch file by hand.
 
Luigi Mattino'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you Steve, my goal concerns Windows shell cause of requirements. As you say the best chooice is to write a batch file and double click on it.
For now i wrote a simple batch "start.bat" that works fine:

in this case it sets out a problem: What happens if there is no JRE_HOME is set on caller win machine?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Easy enough to test right?

The solution is to provide a JRE to run the app (if I were you I would pre-compile the JSPs so I didn't have to provide a JDK instead, but it depends on the app I guess.)
 
Luigi Mattino'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my case it's needed to deploy custom version of the same web application (.war), so i could compile the packets. And in the worst case the caller win machine may not have JDK installed.
Summing up i have to:
- copy jdk (x86 and AMD64) folder on the flash drive folder.
- add a "set" line (set PATH = "jdk path"%PATH%) to my batch file.
Oracle let you download only the installer (.exe) and not the zipped folder?
where i can find a zipped folder?
For the AMD64 version a can copy directly this folder "C:\Program Files\Java\jdk1.7.0_45" but for the x86 version?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luigi Mattino wrote:In my case it's needed to deploy custom version of the same web application (.war), so i could compile the packets. And in the worst case the caller win machine may not have JDK installed.
Summing up i have to:
- copy jdk (x86 and AMD64) folder on the flash drive folder.
- add a "set" line (set PATH = "jdk path"%PATH%) to my batch file.

I would watch out for this, you don't want to set environment variables on the user's machine since it could break what they have - and will be broken when you take your thumbdrive. But there is a way to do it just for Tomcat - I think you do it in the tomcat/bin/catalina.bat file: set the JAVA_HOME parameter there.
Oracle let you download only the installer (.exe) and not the zipped folder?
where i can find a zipped folder?
For the AMD64 version a can copy directly this folder "C:\Program Files\Java\jdk1.7.0_45" but for the x86 version?

Download the installer. When you run the installer for the x86 version I think it will ask you were to install it, so provide a folder you can find it. Otherwise, the default (on a 64 bit machine) will probably be C:\Program Files (x86)\Java\... Remember you may have to fix the PATH and JAVA_HOME params on the computer you are doing the initial install on since the installer may modify these environment variables.
 
Luigi Mattino'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good advice Steve,
I have done some better modify at my batch file, as shown (hoping to be helpful to others):

Thank you.
 
Luigi Mattino'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that there is a product called XAMPP lite that allows you to install a complete PHP/Apache/MySQL, it seams that is included a the Apache Tomcat Web Servlet Applcation Container as ADD-ON.
It is possible to use this for the purpose? has anyone used it?

 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XAMPP installs something - I thought the point was not to install anything? Plus, why would you install all that if you just need a servlet container? And you probably don't want to install servers on a machine otherwise just used for presentations.
 
Luigi Mattino'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand, it does not seem a good solution, but how to allow the start mysql server from a USB stick? Can i configure MySQL 5 by dos batch script?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, so the problem has changed and now includes running a DB as well as a servlet container? If this is still for presentations purposes, maybe using a portable DB like HSQLDB or Derby might work? (That's assuming that there is not a huge amount of data in the DB you need to access.)
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With an alternative to Ulf's great suggestion, possibly using a remote (fixed address) MySQL server to contain the data, as long as the presentations are expected to be in a suitable network position. So if you have small bits of data or you can't rely on the network you use a portable DB. But if you need MySQL and can count on the network you use a remote database.
 
Luigi Mattino'
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, thanks you for your helpful advice.
I exclude using another database because i must rewrite all table in SQL dump file (and review ER model) for allow data congruity.
I realizing that i need a strictly JDK/Tomcat/MySQL environment without worrying of space and i need it is executable also from USB stick, because of that i create a folder root like this:

and some batch script:
start.bat
clean.bat
stop.bat
The occupied space totaled to 4.58 GB, too much! And start process from USB stick it takes 10 minutes, enought isn't it? But it works.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take it using your own laptop for the presentation is out of the question? If the audience won't let you use their network for security reasons, USB mobile adapters are relatively inexpensive these days.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!