Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

problem with java application on windows 98

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
happymae
Asked:
happymae
  • 5
  • 2
  • 2
  • +1
1 Solution
 
objectsCommented:
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
 
happymaeAuthor Commented:
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
 
AlokSinhaCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
happymaeAuthor Commented:
"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
 
AlokSinhaCommented:
then try this:
open a command window and type

command /e:2048

then run your batch file(the original one).

0
 
happymaeAuthor Commented:
same thing..
wait, my windows 98 is jap version by the way..
but it has no relation to this problem whatsoever, does it?
0
 
dnoelppCommented:
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
 
objectsCommented:
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
 
happymaeAuthor Commented:
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
 
happymaeAuthor Commented:
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 5
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now