0

I have already visited the Thread:How to run java application by .bat file but did not help me.

I have written one java program, which uses the two external jar libraries I am able to compile my class.So I wrote the bat file in order to execute my java class but I am getting Class not found exception. My class name is Reminder.java My bat file is

@ECHO ON
set CLASSPATH=.
set CLASSPATH=C:\iWaveSoftware\ITSM adapters-2.5_inst1\lib\depends\derby-10.5.3.0_1.jar,C:\iWaveSoftware\ITSM 

adapters-2.5_inst1\lib\depends\derbyclient-10.5.3.0_1.jar
JAVA -Xms100M -Xmx500M Reminder`

I am getting the below error if i run my windows bat file

Exception in thread "main" java.lang.NoClassDefFoundError: Reminder
Caused by: java.lang.ClassNotFoundException: Reminder
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Reminder.  Program will exit.

Thanks in Advance........Plz help me.

Community
  • 1
  • 1
samash
  • 757
  • 2
  • 15
  • 32

1 Answers1

0

1) There are spaces in your classpath. Sometimes that causes error. Put classpath in quotes. ""

2) use java -cp %CLASSPATH% ... Reminder or (if it has package use package.subpackage.Reminder e.g java.util.List)

Optional
  • 4,387
  • 4
  • 27
  • 45
  • Now I wrote my bat file like below:@ECHO ON set CLASSPATH=. set CLASSPATH=%CLASSPATH%,C:\iWaveSoftware\ITSM adapters-2.5_inst1\lib\depends\derby-10.5.3.0_1.jar,C:\iWaveSoftware\ITSM adapters-2.5_inst1\lib\depends\derbyclient-10.5.3.0_1.jar JAVA -Xms100M -Xmx500M Reminder – samash Sep 26 '13 at 09:50
  • 1) Did you replace spaces? And started java using -cp? 2) Did you check what is the package for Reminder? – Optional Sep 26 '13 at 09:52