Solved

problem with java application on windows 98

Posted on 2001-07-10
10
219 Views
Last Modified: 2008-02-01
my operating system is windows 98.
i have a java application, which i launch using a batch file.
in the batch file, i set both the path and classpath variables in order to run my java application.
i have 2 problems with this. although my java application is launched and it works,
1. an ms-dos application (with an icon the same as the command prompt) is created, which works basically the same as my batch file
2. there is a "too many parameter" message on the command prompt
3. the command prompt does not close after i close my application..

can anybody help me with this?
0
Comment
Question by:happymae
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6271846
1. Try launching your app with javaw instead of java
2. Need to see your batch file
3. Sounds like the app doesn't exit on close, do u have the code?
0
 

Author Comment

by:happymae
ID: 6271876
1. same thing happens even with javaw. a PIF file is created btw..
2. for the "too many parameters" error, i read somewhere that i should set my path in the autoexec.bat.. with that, this is my batch file

-------------
@echo off
c:
cd \AddBook\chgpw
set path=C:\Program Files\IBM\Java12\jre\bin;%path%;
set classpath=c:\AddBook\Chgpw\password.jar;C:\Program Files\IBM\Java12\jre\lib\rt.jar;%classpath%;
java Password
exit
-------------

but if i don't set the path variable in my autoexec.bat, this is the batch file
-------------
@echo off
c:
cd \AddBook\chgpw
set classpath=c:\AddBook\Chgpw\password.jar;C:\Program Files\IBM\Java12\jre\lib\rt.jar;%classpath%;
java Password
exit
-------------

3. works fine with windows 2000.. unfortunately, i dont have the code..
0
 

Expert Comment

by:AlokSinha
ID: 6271918
in the begining of your batch file just add this lines:

command /e:2048

what this does is to set the initial environment size to 2048 bytes(you can choose any other value, by default its set to 128 bytes)
I think this should solve your problem of "too many parameter" .

The other part of the problem can be solved by modifying your application(changing the method which handles your window close event);
0
 

Author Comment

by:happymae
ID: 6271932
"in the begining of your batch file just add this lines:
command /e:2048"

i tried that, but what happened is that a command prompt opens, the following appears:
--------------------
c:\AddBook\ChgPW>

c:\AddBook\ChgPW>command /e:2048

Microsoft(R) Windows 98
   (C)Copyright Microsoft Corp 1981-1999

c:\AddBook\ChgPW>
---------------------

nothing happens after this..



0
 

Expert Comment

by:AlokSinha
ID: 6271968
then try this:
open a command window and type

command /e:2048

then run your batch file(the original one).

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:happymae
ID: 6271998
same thing..
wait, my windows 98 is jap version by the way..
but it has no relation to this problem whatsoever, does it?
0
 
LVL 3

Accepted Solution

by:
dnoelpp earned 80 total points
ID: 6272311
This whole thing seems to be a collection of different, not very related problems.

1. "too many parameters" seems to be a dos prompt memory problem. So the suggestions of AlokSinha go in the right direction, but they fail because of minor problems like typos. Just experiment a little with the /e parameter of command.exe. An alternative solution would be to change config.sys and give the dos prompt more memory for the parameters. Or use NT/2000, they don't know such problems with the dos prompt.

2. Dos window: Usually each Java application has a console. The console is the place for the standard out- and input. Windows doesn't manage consoles very well (compared to unix), so there is a need for two different java launchers: java.exe and javaw.exe. The latter doesn't open a console window, so you can't use standard output and input [System.out.println() doesn't work] without redirecting.

3. Dos window doesn't close: This can depend on the configuration of the link. One of the configuration options is something like "Close Window after exit".
Of course the problem could be, too, that your Java program doesn't exit correctly when the window was closed.

*** SUMMARY ***

This is a very vague "solution", because the problems are very vague, too. My hint is: Try to solve all problems stepwise. First try to solve the "too many parameters" problem, etc. Take time and recheck often!

Good luck!
0
 
LVL 92

Expert Comment

by:objects
ID: 6272342
Move all your jar files into your ext directory (located inside the lib directory in your java installation), you can then get rid of the need for your classpath.

Please explain 1 & 3 in more detail as it sounds like we're misunderstanding you.
If you run the command from the commandline (no batch file) does the DOS window popup.
And in 3. are you saying that the extra popped up dos window does not go away?


0
 

Author Comment

by:happymae
ID: 6272404
i also did some research, and i have solved problems 2 and 3..
1. actually, it's a PIF file that is created. and, it seems that there's nothing i can do about it.
2. "too many parameters". i just changed this
set path=C:\Program Files\IBM\Java12\jre\bin;%path%;
to
set path="C:\Program Files\IBM\Java12\jre\bin;%path%;"
cannot understand why it worked, but it did.
3. in the properties of the batch file, under the programs tab, i just checked "close window after program ends" (or something like that since my OS is jap)..

my final batch file looks like this:
-------
@echo off
c:
cd \AddBook\chgpw
set path="C:\Program Files\IBM\Java12\jre\bin;%path%";
set classpath=c:\AddBook\Chgpw\password.jar;C:\Program Files\IBM\Java12\jre\lib\rt.jar;%classpath%;
javaw Password
exit
------

to answer object, yes, with my original batch file, my command prompt window does not close even after i close my java application (seems like i have to edit the batch file's properties)

dnoelpp, you're right about nt/2000. i never had these problems..

so, with my pif file and new batch file, everything is now ok.. i really cannot understand how i got it to work, but im not going to question that anymore. all that matters is that it's now working ;)

thanks to everyone who helped.. i hope someday, someone who will have the same problem will find this useful.

0
 

Author Comment

by:happymae
ID: 6272405
i also did some research, and i have solved problems 2 and 3..
1. actually, it's a PIF file that is created. and, it seems that there's nothing i can do about it.
2. "too many parameters". i just changed this
set path=C:\Program Files\IBM\Java12\jre\bin;%path%;
to
set path="C:\Program Files\IBM\Java12\jre\bin;%path%;"
cannot understand why it worked, but it did.
3. in the properties of the batch file, under the programs tab, i just checked "close window after program ends" (or something like that since my OS is jap)..

my final batch file looks like this:
-------
@echo off
c:
cd \AddBook\chgpw
set path="C:\Program Files\IBM\Java12\jre\bin;%path%";
set classpath=c:\AddBook\Chgpw\password.jar;C:\Program Files\IBM\Java12\jre\lib\rt.jar;%classpath%;
javaw Password
exit
------

to answer object, yes, with my original batch file, my command prompt window does not close even after i close my java application (seems like i have to edit the batch file's properties)

dnoelpp, you're right about nt/2000. i never had these problems..

so, with my pif file and new batch file, everything is now ok.. i really cannot understand how i got it to work, but im not going to question that anymore. all that matters is that it's now working ;)

thanks to everyone who helped.. i hope someday, someone who will have the same problem will find this useful.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now