473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Starting Java program from Win CDROM

Hello,

I am a pure Linux guy. I wrote a Java program that is going to be used
by some Windows people, and I wish the startup of the program to be as
simple as possible, namely to double-click on the icon of a BAT script
on the CDROM. The program accesses files in a directory which path is
given as an argument on the command line. The script I have now is the
following:

--- start of script ---

set AB_JAR_DIR=D:\ab
set AB_DATA_DIR=D:\ab\data
set AB_MEM_MAX=200m

cd %AB_JAR_DIR%
java -Xmx%AB_MEM_MAX% -Ddatapath=%AB_DATA_DIR% -jar ab-0.1.3.jar

--- end of script ---

Unfortunately I know that there are people around who have their CDROM
attached to another drive letter than D:, which would prevent that
script to be executed properly. Thus the question:

How do I find the drive letter of the CDROM the script was started
from, and how do I use it in the script ?

Is there a simpler way to to that ?

Thanks in advance.
Disclaimer: I didn't find any active comp.*.dos.* newsgroup to post
that question and I am fully aware of the fact this might not be the
ideal place to ask that question, but I am sure there are other
DOS-illiterate Java programmers (like me) around for whom the answers
might be useful too.
Jul 17 '05 #1
2 2739
This may not answer your original question, but before worrying about the CD
drive, how are you going to run your Java program? I mean, do you realize
that in the world of Windows, many (actually, most) of the users don't have
the JVM on their desktops, and the majority of them never heard of Java?

There are packaging products that bundle the application classes and JAR
files with JRE, and you may want to explore this route. In this case, you
will not need the BAT script.

Alex Molochnikov
Gestalt Corporation

"enclume42" <en*******@hotmail.com> wrote in message
news:4c**************************@posting.google.c om...
Hello,

I am a pure Linux guy. I wrote a Java program that is going to be used
by some Windows people, and I wish the startup of the program to be as
simple as possible, namely to double-click on the icon of a BAT script
on the CDROM. The program accesses files in a directory which path is
given as an argument on the command line. The script I have now is the
following:

--- start of script ---

set AB_JAR_DIR=D:\ab
set AB_DATA_DIR=D:\ab\data
set AB_MEM_MAX=200m

cd %AB_JAR_DIR%
java -Xmx%AB_MEM_MAX% -Ddatapath=%AB_DATA_DIR% -jar ab-0.1.3.jar

--- end of script ---

Unfortunately I know that there are people around who have their CDROM
attached to another drive letter than D:, which would prevent that
script to be executed properly. Thus the question:

How do I find the drive letter of the CDROM the script was started
from, and how do I use it in the script ?

Is there a simpler way to to that ?

Thanks in advance.
Disclaimer: I didn't find any active comp.*.dos.* newsgroup to post
that question and I am fully aware of the fact this might not be the
ideal place to ask that question, but I am sure there are other
DOS-illiterate Java programmers (like me) around for whom the answers
might be useful too.

Jul 17 '05 #2
enclume42 wrote:
Hello,

I am a pure Linux guy. I wrote a Java program that is going to be used
by some Windows people, and I wish the startup of the program to be as
simple as possible, namely to double-click on the icon of a BAT script
on the CDROM. The program accesses files in a directory which path is
given as an argument on the command line. The script I have now is the
following:

--- start of script ---

set AB_JAR_DIR=D:\ab
set AB_DATA_DIR=D:\ab\data
set AB_MEM_MAX=200m

cd %AB_JAR_DIR%
java -Xmx%AB_MEM_MAX% -Ddatapath=%AB_DATA_DIR% -jar ab-0.1.3.jar

--- end of script ---

Unfortunately I know that there are people around who have their CDROM
attached to another drive letter than D:, which would prevent that
script to be executed properly. Thus the question:

How do I find the drive letter of the CDROM the script was started
from, and how do I use it in the script ?

Is there a simpler way to to that ?


First, it is probably unnecessary. When a user double-clicks a BAT file
in Windows, the DOS shell is started in the directory of the BAT file.
So you could safely use relative directories, or directories without the
drive letter (e.g. \ab\data).

Second, if you find you need it after all, the DOS shell provides some
magic incantations to get the drive, path, etc. of any file, including
the currently running script. These have the form %~dp0 and such. To
get the exact syntax, go to your Windows machine and go to Windows help
(Windows key + F1 or Start -> Help). Go to '%' in the index.

HTH,
Ray
--
XML is the programmer's duct tape.
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Silvio Golubović | last post by:
I have a problem with my CDROM. It reads only original cd.
13
by: Ash | last post by:
Hey. Im new to Java, and am having a prroblem with the netbeans IDE. every time i try to import java.awt.* , I can't use any of the methods(like they don't exist). I can compile it fine, but when I...
2
by: Micke | last post by:
I have problems with this simple program below. It starts to read and dump wav data to file but stops after 2MB. The cdda2wav processes are still alive but nothing more is happening. I have more...
1
by: Robert | last post by:
I am reading this book - Java Unleashed - However I cannot get the programs on the CD because the CDrom no longer works. I am just wondering if anyone has the CDrom available and can send me a copy...
9
by: Paul Steele | last post by:
I am writing a C# app that needs to periodically poll for cdroms and usb storage device insertions. I've looked at the WMI functions but haven't found anything all that useful. The closest is...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
6
by: AOECheatmaster | last post by:
I am trying to write a C++ autorun launcher, but i have a problem, i cannot figure out how to set the buttons to launch the apps to use whatever drive number the CDROM is located at, all i can...
3
by: Ognjen Bezanov | last post by:
Hello, I am trying to control a CD-ROM drive using python. The code I use is shown below.
14
by: Keith McCutcheon | last post by:
I've got a jar file that I'm loading with Java's Web Start. When I load the ..jnlp file from a browser, the application installs and runs properly the first time. If I close the application and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.