• Post Reply Bookmark Topic Watch Topic
  • New Topic

classpath problem  RSS feed

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i made bat file so that i can compile and run java program. my problem is that it is compiling but when i am tring to program by java file name. new window bat file is popping up .
this is my bat file content

set JDKPATH=D:\Program Files\Java\jdk1.6.0_11
set PATH=%JDKPATH%\bin;%PATH%
set CLASSPATH=.;%CLASSPATH%;%JDKPATH%\lib
start


so please tell why this is happing instead of program running it is oping new console window.
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "start" command opens a new window. Why are you calling it ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you call your batch file "start.bat" ? Either rename it, or call it via ".\start.bat".
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or just start.bat, without the .\
That's enough to distinguish between the built-in start command and your BAT file.
 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i use it start because without start window is disappearing.

can any one tell it if there is problem with start which i wrote than why it is compiling java code . It is showing new window only when i want to run complied code.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
start will open new command prompt window. You have set classpath and path in the batch file. After running that batch file, you have to compile and run your program by using the following.

For compilation type
javac <filename.java>

For execution, upon successful compilation type
java <filename>

in your case, if file name is start.java, type
javac start.java, after successful compilation type java start at command prompt.
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And why are you adding the Java installation folder or its lib directory to your classpath?

Don't put your own code in that folder, and don't add it to your classpath.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!